Search code examples
delphidelphi-7datamodule

access a component on one of tabsheets from datamodule


Maybe trivial,but can't seem to figure it out.... I am using RAIZE components i.e rzPageControl1 and one of my sheets is called PRO.It (rzPageControl1) resides on Form1. Now,I have an cxTextEdit4 on that sheet which I need to access from Datamodule2.Tablename2 on new record event.

But cant seem to access it properly...

Does anyone know the syntax ?

I tried ; Form1.rzPageControl1. etc but cant seem to make delphi list me the components available.... Please help ...


Solution

  • The components on the form are all in the top level scope under the name of the form itself, and are not sub-component properties of your page control.

    You want Form1.Button1, not Form1.rzPageControl1.Button1, even if Button1 is physically dropped onto rzPageControl1.

    In delphi terms we say that the Button is OWNED by the Form, but it is PARENTED by a tab on the page control, meaning it appears as part of the particular sub-page on the page control, but it still belongs (is owned) from memory point of view, and a scope point of view, by the form.