Jump to content

which function can show my form?


55143681

Recommended Posts

I have create some forms,all the form's parent is set to UnimContainerPanel1,I have some buttons to switch and display the different forms,

but they can only be show at the first time created,when a new form is created, the old can never show again,how to show the form first created?

TUnimFormMain01 *mainForm01=(TUnimFormMain01 *)UnimContainerPanel1->FindChildControl("UnimFormMain01");
if(mainForm01!=NULL)
    {
    ShowMessage(mainForm01->Caption);
    mainForm01->BringToFront();
    }
else
    {
    mainForm01=new TUnimFormMain01(UniApplication);
    mainForm01->Parent=UnimContainerPanel1;
    }

Link to comment
Share on other sites

6 minutes ago, 55143681 said:

I have create some forms,all the form's parent is set to UnimContainerPanel1,I have some buttons to switch and display the different forms,

but they can only be show at the first time created,when a new form is created, the old can never show again,how to show the form first created?

TUnimFormMain01 *mainForm01=(TUnimFormMain01 *)UnimContainerPanel1->FindChildControl("UnimFormMain01");
if(mainForm01!=NULL)
    {
    ShowMessage(mainForm01->Caption);
    mainForm01->BringToFront();
    }
else
    {
    mainForm01=new TUnimFormMain01(UniApplication);
    mainForm01->Parent=UnimContainerPanel1;
    }

mainForm01 and mainForm02 all  are UnimContainerPanel1's child,I first create mainform01,and displayed normal,then create mainform02 ,and displayed normal,

then how to display the first created form (mainform01 ) again?

 

 

void __fastcall TMainmForm::UnimSegmentedButton1Click(TUnimButtonItem *Sender)
{
if(Sender->ButtonId==0)
    {
    TUnimFormMain01 *mainForm01=(TUnimFormMain01 *)UnimContainerPanel1->FindChildControl("UnimFormMain01");
    if(mainForm01!=NULL)
        {
        //ShowMessage(mainForm01->Caption);
        mainForm01->BringToFront();
        }
    else
        {
        mainForm01=new TUnimFormMain01(UniApplication);
        mainForm01->Parent=UnimContainerPanel1;
        }

    }
if(Sender->ButtonId==1)
    {
    TUnimFormMain02 *mainForm02=(TUnimFormMain02 *)UnimContainerPanel1->FindChildControl("UnimFormMain02");
    if(mainForm02!=NULL)
        {
        //ShowMessage(mainForm02->Caption);
        mainForm02->BringToFront();
        }
    else
        {
        mainForm02=new TUnimFormMain02(UniApplication);
        mainForm02->Parent=UnimContainerPanel1;
        }
    }
if(Sender->ButtonId==2)
    {

    }
if(Sender->ButtonId==3)
    {

    }

}
//---------------------------------------------------------------------------
 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...