yxzzjg Posted November 29, 2015 Share Posted November 29, 2015 Write the form name transfer in the Create, such as form1, the form will automatically create the display. I just need to do form1 variable transmission. How to do? procedure TFMain.UniFrameCreate(Sender: TObject); begin Form1; //Automatically displayed Form1, not what I need End; ========================= I need protected FName:TUniForm; procedure TFmain.UniFrameCreate(Sender: TObject); begin FName:=Form1; //You do not need to show end; procedure TFmain.btnAddClick(Sender: TObject); begin FName.ShowModal(showcallback); end; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 29, 2015 Administrators Share Posted November 29, 2015 Please use datamodules or mainmodule to keep global vars. Forms should be displayed after created. Quote Link to comment Share on other sites More sharing options...
yxzzjg Posted November 30, 2015 Author Share Posted November 30, 2015 Please use datamodules or mainmodule to keep global vars. Forms should be displayed after created. It is the same Quote Link to comment Share on other sites More sharing options...
stas Posted November 30, 2015 Share Posted November 30, 2015 Use free form And put in variable formclass instead form protected FName:TUniFormClass; procedure TFmain.UniFrameCreate(Sender: TObject); begin FName:=TForm1; end; procedure TFmain.btnAddClick(Sender: TObject); begin TUniFormClass(FName).Create(UniApplication).ShowModal(showcallback); end; Quote Link to comment Share on other sites More sharing options...
yxzzjg Posted November 30, 2015 Author Share Posted November 30, 2015 Use free form And put in variable formclass instead form protected FName:TUniFormClass; procedure TFmain.UniFrameCreate(Sender: TObject); begin FName:=TForm1; end; procedure TFmain.btnAddClick(Sender: TObject); begin TUniFormClass(FName).Create(UniApplication).ShowModal(showcallback); end; thank you,OK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.