Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reach TIWForm’s or TIWFrame’s components from another TIWForm or TIWFrame in c
#1
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:    // IDE-managed Components
TIWRegion *IWFrameRegion;
private:    // User declarations
    TIWForm1 *IWForm1;
    TIWFrame1 *IWFrame1;
public:        // User declarations
        __fastcall TIWFrame2(TComponent* Owner);
};
//---------------------------------------------------------------------------

//.cpp
__fastcall TIWFrame2::TIWFrame2(TComponent* Owner)
        : 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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)