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