How to reach TIWForm’s or TIWFrame’s components from another TIWForm or TIWFrame in c

<< Click to Display Table of Contents >>

Navigation:  Forum >

How to reach TIWForm’s or TIWFrame’s components from another TIWForm or TIWFrame in c

Forum link

 


 

03-24-2023, 01:01 PM:

 

I am working with a single IWForm in which I display alternatively IWFrames though it may have two IWFrame at the same time.

 

Under VCL and FMX environment TForm class is redefined as extern package that can be used to reach its properties everywhere within the project.

 

Code:

 

extern PACKAGE TForm1 *Form1;

 

There is no such a redefinition under IntraWeb and I didn’t manage to access properly the properties of my IWForm and IWFrame apart from their own source.

 

The workaround I found is to manually redefine IWForm and IWFrame like below:

 

Code:

 

//.h

 

class TIWFrame2: public TFrame

 

{

 

__published:&nbsp;&nbsp;&nbsp;&nbsp;// IDE-managed Components

 

TIWRegion *IWFrameRegion;

 

private:&nbsp;&nbsp;&nbsp;&nbsp;// User declarations

 

&nbsp;&nbsp;&nbsp;&nbsp;TIWForm1 *IWForm1;

 

    TIWFrame1 *IWFrame1;

 

public:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// User declarations

 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__fastcall TIWFrame2(TComponent* Owner);

 

};

 

//---------------------------------------------------------------------------

 

//.cpp

 

__fastcall TIWFrame2::TIWFrame2(TComponent* Owner)

 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: TFrame(Owner)

 

{

 

IWForm1 = static_cast<TIWForm1*>(Owner);

 

IWFrame1 = static_cast<TIWFrame1*>(Owner);

 

}

 

//---------------------------------------------------------------------------

 

This snippet doesn’t compile in the UserSessionUnit, so every IWFrame must have its own declaration of almost all other IWFrame resulting in a messy code.

 

Furthermore, this doesn’t work every time. If two IWFrame are displayed in the IWForm, the tip doesn’t work for the first one.

 

I am afraid I am missing something trivial allowing to reach TIWForm’s or TIWFrame’s components from another TIWForm or TIWFrame in C++Builder.

 

Any idea?

 

Thank you for your help & Kind regards.