ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Assign LayerMView & Histogram to dynamically created ImageEnView on TabChange
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Watsch

Germany
1 Posts

Posted - Jun 13 2023 :  10:20:38  Show Profile  Reply
Hi there,

I create an ImageEnView and a tab at runtime to open/create new images in tabs. But how can I assign the dynamically created components to the Histgram and ImageEnLayerMView so that on a tab change the layers and histogram show the corresponding image "values"?

My code to create a new picture:
procedure TFormToolsBildbearbeitungDateiNeu.ButtonOKClick(Sender: TObject);
var
  TabSheet   : TRzTabSheet;
  TabNummer  : Integer;
  ImageEnView: TImageEnView;
begin
// Create a new tab and assign to PageControl
  TabSheet := TRzTabSheet.Create(FormToolsBildbearbeitungMain.RzPageControl);
  TabSheet.Caption := AdvEditName.Text;
  TabSheet.Name := 'TabSheet' + IntToStr(FormToolsBildbearbeitungMain.RzPageControl.PageCount);
  TabSheet.PageControl := FormToolsBildbearbeitungMain.RzPageControl;

// Create ImageEnView component
  ImageEnView := TImageEnView.Create(TabSheet);
  ImageEnView.Name := 'ImageEnView' + TabSheet.Name;
  ImageEnView.Parent := TabSheet;
  ImageEnView.Left := 0;
  ImageEnView.Top := 0;

    case AdvComboBoxHintergrundinhalt.ItemIndex of
      0: ImageEnView.Background := clWhite;
//      1: ImageEnView.Background := FormToolsBildbearbeitungMain.IEColorButtonHintergrundfarbe.SelectedColor;
      2: ImageEnView.Background := clNone;
    end;

  ImageEnView.Width := StrToInt(AdvEditBreite.Text);
  ImageEnView.Height := StrToInt(AdvEditHoehe.Text);

  ImageEnView.Align := alClient;
  ImageEnView.CenterImage;

  ImageEnView.Visible := TRUE;

  TabNummer := FormToolsBildbearbeitungMain.RzPageControl.PageCount + 1;
  FormToolsBildbearbeitungMain.RzPageControl.ActivePageIndex := TabNummer - 2;

// Set focus on the actual tab
  FormToolsBildbearbeitungMain.RzPageControl.ActivePage.SetFocus;

// Assign the component "ImageEnView" to the component "ImageEnLayerMView"
//  FormToolsBildbearbeitungMain.ImageEnLayerMView.AttachedImageEnView := ImageEnView;

// Close Window
  Close;
end;


However, when changing the tabs, layers and histogram do not update. Below is an example code for the OnTabChange event:

procedure TFormToolsBildbearbeitungMain.RzPageControlPageChange(
  Sender: TObject);
begin
// Hier der aktuellen ImageEn-Komponente die dazugehörigen Komponenten zuweisen
// Histogram, Ebenen, etc...
  HistogramBox.AttachedImageEnProc := ImageEnProc;
end;


As I said, I have no idea. I also tried "FindComponent", etc.. without luck. If anyone could provide me with a code snippet, that would be more than great and highly appreciated.

Thanks in advance,

Watsch

Watsch

xequte

38537 Posts

Posted - Jun 13 2023 :  11:42:23  Show Profile  Reply
Hi

When you say they don't update, do you mean they have no content or they have the original content which does not show any further changes?

Does it work if you explicitly call the Update() methods or assign content, e.g. using:

http://www.imageen.com/help/THistogramBox.UpdateFromBitmap.html

You might need to create a simple demo that shows the issue so I can understand it better.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38537 Posts

Posted - Jun 15 2023 :  06:05:39  Show Profile  Reply
Hi

Sorry, I'm out of the office and wasn't able to remotely connect with my dev environment today to test it.

However looking at the code, it makes reference to Form1.ImageEnProc which does not seem to have any purpose. The histogram should be attached to the ImageEnView it relates to, e.g.

HistogramBox.AttachedImageEnProc := ImageEnView1.Proc;

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: