Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 11 total |
embedded forms |
Sun, Aug 31 2014 2:27 AM | Permanent Link |
Harry de Boer | Hi
I wonder how it's possible that the 'same' embedded form is shown if you do this procedure TForm1.frmGeelClick(Sender: TObject); var frmGeel: TfrmGeel; begin frmGeel:=TfrmGeel.Create(pnlDock); frmGeel.Show; end; I thought the second time I would get an error (form already exists - already created), but yet another form is shown each time this prcedure is executed. How can you check if a Form already is created to show it just once? Regards, Harry |
Sun, Aug 31 2014 5:31 AM | Permanent Link |
Ronald | Hi Harry,
I would make the frmGeel global for the parentform (TForm1) and set the initial value at nil. Then you can check if the form is already created with: if not Assigned(frmGeel) then frmGeel:=TfrmGeel.Create(pnlDock) else frmGeel.Show; Greetings, Ronald "Harry de Boer" schreef in bericht news:FB012EF7-42DB-492D-8DC8-315A69D80B85@news.elevatesoft.com... Hi I wonder how it's possible that the 'same' embedded form is shown if you do this procedure TForm1.frmGeelClick(Sender: TObject); var frmGeel: TfrmGeel; begin frmGeel:=TfrmGeel.Create(pnlDock); frmGeel.Show; end; I thought the second time I would get an error (form already exists - already created), but yet another form is shown each time this prcedure is executed. How can you check if a Form already is created to show it just once? Regards, Harry |
Sun, Aug 31 2014 6:22 AM | Permanent Link |
Harry de Boer | >>I would make the frmGeel global for the parentform (TForm1) and set the
initial value at nil. Hi Ronald, where and how do I exactly do that? Regards, Harry |
Sun, Aug 31 2014 5:07 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | On 31/08/2014 10:22 p.m., Harry de Boer wrote:
>>> I would make the frmGeel global for the parentform (TForm1) and set the > initial value at nil. > > Hi Ronald, > > where and how do I exactly do that? > > Regards, Harry > Hi Harry From a EWB raw beginner ... From Delphi experience, I would take the "frmGeel: TfrmGeel;" out of the frmGeelClick event and put it in the Private declarations of TForm1. Then in FormCreate put "frmGeel:=nil;" and use the code as per Ronald's reply. HTH Cheers Jeff |
Mon, Sep 1 2014 1:55 AM | Permanent Link |
Harry de Boer | >> From Delphi experience, I would take the "frmGeel: TfrmGeel;" out of
the frmGeelClick event and put it in the Private declarations of TForm1. Then in FormCreate put "frmGeel:=nil;" and use the code as per Ronald's reply. Hi Jeff, I tried -besides the := nil in form.create- putting frmGeel : TfrmGeel in the: - private declarations of the form (error: referenced type does not exists) - in a var declaration of the interface section (error: referenced type does not exists) - in a var declaration of the implementation section (multiple forms can appear, - what I want to prevent) Regards, Harry |
Mon, Sep 1 2014 4:24 AM | Permanent Link |
Matthew Jones | Harry de Boer wrote:
> interface section (error: referenced type does not exists) That error is because the form type you are referencing does not exist in the current unit, so you must add the unit it is defined in to the uses clause above the use. Most forms will have a global variable defined for them automatically, so you just need to add the form's unit to the uses clauses and you can access it. This is basic Delphi programming, so once you have it understood you will be going much faster to your goal. -- Matthew Jones |
Mon, Sep 1 2014 11:52 AM | Permanent Link |
Harry de Boer | "Matthew Jones" wrote:
That error is because the form type you are referencing does not exist in the current unit, so you must add the unit it is defined in to the uses clause above the use. Most forms will have a global variable defined for them automatically, so you just need to add the form's unit to the uses clauses and you can access it. This is basic Delphi programming, so once you have it understood you will be going much faster to your goal. Hi Matthew, it's been a long time ago since I worked with OP in Delphi, however I tried putting the unit in the uses clause but it does not work. Are you sure in EWB this is also possible? C Regards, Harry |
Mon, Sep 1 2014 12:18 PM | Permanent Link |
Matthew Jones | Harry de Boer wrote:
> it's been a long time ago since I worked with OP in Delphi, however I > tried putting the unit in the uses clause but it does not work. Are > you sure in EWB this is also possible? C Certainly does for me! If you want to post code then please do, but you may be best to check the demos and modify them to work for you too. -- Matthew Jones |
Mon, Sep 1 2014 3:24 PM | Permanent Link |
Harry de Boer | Hi Matthew
I came up with this little testproject (looked at the embeddedform demo) but I can't get it to work, I must be missing something. Any help would be appreciated. Regards, Harry Attachments: test.zip |
Mon, Sep 1 2014 4:45 PM | Permanent Link |
Raul Team Elevate | On 9/1/2014 3:24 PM, Harry de Boer wrote:
> I came up with this little testproject (looked at the embeddedform demo) but I can't get it to work, I must be missing something. Any help would be appreciated. Harry, Your form 2 is being auto-created so first under Project -> Options -> Forms move Form2 into "available forms". You don't want it to be auto-created since you'll be creating and embedding it yourself. That should fix the issue of form not appearing embedded. However to make this "nicer" you can do few other things: Unit2 already contains the default form definition (var Form2: TForm2 so you can use that if you need "single instance" - it basically works as global variable hence you can completely remove the Form2:Tform2; declaration from unit 1. If you want the embedding to look cleaner then on form 2 set showcaption=false, showborder=false, showshadow=false and dock=sdtFill This should result in form2 fully filling the panel. Raul |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, October 9, 2024 at 05:37 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |