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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...