[lazarus] form embedded in another form
Hi, As the subject says... Is this supported under Lazarus? And under Linux and Windows platforms. I currently have a TabControl on a form. As I change the tabs I want to embed different forms. Here is the code I have so far. Under Linux (GTK1) it works find. Under Windows the TabControl doesn't paint correctly and I can only change one tab before the GUI freezes up. I have to kill the application from the Task Manager. Anybody got this work under Lazarus? Am I missing some property settings? --- procedure TModuleHeaderForm.TabControl1Change(Sender: TObject); begin FreeAndNil(FEmbededForm); case TabControl1.TabIndex of 0: CreateEmbededForm(TPanelHeader); 1: CreateEmbededForm(TPanelDetail); 2: CreateEmbededForm(TPanelOutcome); 3: CreateEmbededForm(TPanelSlide); end; end; procedure TModuleHeaderForm.CreateEmbededForm(AForm: TFormClassType); begin FEmbededForm := AForm.Create(self); FEmbededForm.BorderStyle := bsNone; FEmbededForm.Parent := TabControl1; FEmbededForm.Align := alClient; FEmbededForm.Show; end; --- Regards, - Graeme - _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Graeme Geldenhuys schrieb: Hi, As the subject says... Is this supported under Lazarus? And under Linux and Windows platforms. Official not but i use it for 2 years. with an little trick in win32 and in linux it works. I currently have a TabControl on a form. As I change the tabs I want to embed different forms. Here is the code I have so far. Under Linux (GTK1) it works find. Under Windows the TabControl doesn't paint correctly and I can only change one tab before the GUI freezes up. I have to kill the application from the Task Manager. Anybody got this work under Lazarus? Am I missing some property settings? --- procedure TModuleHeaderForm.TabControl1Change(Sender: TObject); begin FreeAndNil(FEmbededForm); case TabControl1.TabIndex of 0: CreateEmbededForm(TPanelHeader); 1: CreateEmbededForm(TPanelDetail); 2: CreateEmbededForm(TPanelOutcome); 3: CreateEmbededForm(TPanelSlide); end; end; procedure TModuleHeaderForm.CreateEmbededForm(AForm: TFormClassType); begin FEmbededForm := AForm.Create(self); FEmbededForm.BorderStyle := bsNone; FEmbededForm.Parent := TabControl1; FEmbededForm.Align := alClient; FEmbededForm.Show; end; --- Regards, - Graeme - _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Christian Ulrich wrote: Graeme Geldenhuys schrieb: Hi, As the subject says... Is this supported under Lazarus? And under Linux and Windows platforms. Official not but i use it for 2 years. with an little trick in win32 and in linux it works. I currently have a TabControl on a form. As I change the tabs I want to embed different forms. Here is the code I have so far. Under Linux (GTK1) it works find. Under Windows the TabControl doesn't paint correctly and I can only change one tab before the GUI freezes up. I have to kill the application from the Task Manager. Anybody got this work under Lazarus? Am I missing some property settings? --- procedure TModuleHeaderForm.TabControl1Change(Sender: TObject); begin FreeAndNil(FEmbededForm); case TabControl1.TabIndex of 0: CreateEmbededForm(TPanelHeader); 1: CreateEmbededForm(TPanelDetail); 2: CreateEmbededForm(TPanelOutcome); 3: CreateEmbededForm(TPanelSlide); end; end; procedure TModuleHeaderForm.CreateEmbededForm(AForm: TFormClassType); begin FEmbededForm := AForm.Create(self); FEmbededForm.BorderStyle := bsNone; FEmbededForm.Parent := TabControl1; FEmbededForm.Align := alClient; FEmbededForm.Show; end; Christian, Can you elaborate on the trick you used for Win32? I may need to do this same thing soon. -- Warm Regards, Lee _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Can you elaborate on the trick you used for Win32? I may need to do this same thing soon. i have documentated in the bugreport http://www.freepascal.org/mantis/view.php?id=1052 thers also an patch for the lcl that inserts an internal workaround but nobody wants to apply it _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Christian Ulrich wrote: Can you elaborate on the trick you used for Win32? I may need to do this same thing soon. i have documentated in the bugreport http://www.freepascal.org/mantis/view.php?id=1052 thers also an patch for the lcl that inserts an internal workaround but nobody wants to apply it Thanks, -- Warm Regards, Lee _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Thanks Christian I'll read the bug report tomorrow and give it a try. Regards, - Graeme - On 13/06/07, Christian Ulrich <[EMAIL PROTECTED]> wrote: > > Can you elaborate on the trick you used for Win32? I may need to do > this same thing soon. > i have documentated in the bugreport http://www.freepascal.org/mantis/view.php?id=1052 thers also an patch for the lcl that inserts an internal workaround but nobody wants to apply it _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Hi Christian, That's again for the workaround... What is the $6 stand for? Would it have any side effects under Linux, that might bite me later? Here follows my code: procedure TModuleHeaderForm.WndProc(var TheMessage: TLMessage); begin if TheMessage.Msg = $6 then if not Focused then TabControl1.SetFocus; inherited WndProc(TheMessage); end; Regards, - Graeme - On 13/06/07, Christian Ulrich <[EMAIL PROTECTED]> wrote: i have documentated in the bugreport http://www.freepascal.org/mantis/view.php?id=1052 _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Graeme Geldenhuys wrote: Hi, As the subject says... Is this supported under Lazarus? And under Linux and Windows platforms. Isn't this just a hack to mimick the lack of frames ? Marc I currently have a TabControl on a form. As I change the tabs I want to embed different forms. Here is the code I have so far. Under Linux (GTK1) it works find. Under Windows the TabControl doesn't paint correctly and I can only change one tab before the GUI freezes up. I have to kill the application from the Task Manager. Anybody got this work under Lazarus? Am I missing some property settings? --- procedure TModuleHeaderForm.TabControl1Change(Sender: TObject); begin FreeAndNil(FEmbededForm); case TabControl1.TabIndex of 0: CreateEmbededForm(TPanelHeader); 1: CreateEmbededForm(TPanelDetail); 2: CreateEmbededForm(TPanelOutcome); 3: CreateEmbededForm(TPanelSlide); end; end; procedure TModuleHeaderForm.CreateEmbededForm(AForm: TFormClassType); begin FEmbededForm := AForm.Create(self); FEmbededForm.BorderStyle := bsNone; FEmbededForm.Parent := TabControl1; FEmbededForm.Align := alClient; FEmbededForm.Show; end; --- Regards, - Graeme - _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
On 14/06/07, Marc Weustink <[EMAIL PROTECTED]> wrote: Isn't this just a hack to mimick the lack of frames ? Yes! The only difference being that frames can be used visually in the Form Designer. The visual designing is really not that important to me. What I do need is to be able to use a form embedded or not, depending on how my GUI is built or where in the application it is used. As far as I know Lazarus doesn't support Frames yet? Graeme. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Found one issue with the workaround. It's *not* WINE friendly! I can't get focus to the embedded form at all. Graeme. On 14/06/07, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: Hi Christian, That's again for the workaround... What is the $6 stand for? Would it have any side effects under Linux, that might bite me later? Here follows my code: procedure TModuleHeaderForm.WndProc(var TheMessage: TLMessage); begin if TheMessage.Msg = $6 then if not Focused then TabControl1.SetFocus; inherited WndProc(TheMessage); end; Regards, - Graeme - On 13/06/07, Christian Ulrich <[EMAIL PROTECTED]> wrote: > i have documentated in the bugreport > http://www.freepascal.org/mantis/view.php?id=1052 > _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Graeme Geldenhuys schrieb: Hi Christian, That's again for the workaround... What is the $6 stand for? Would it have any side effects under Linux, that might bite me later? Here follows my code: I dont know i have an {$IFDEF MSINDOWS} around it. Another thing that not work are Tab :( But this issue is not long ago. With 0.9.22 it works fine. For now the Tabulator key only work on TDBGrid not between controls. I hope someone who has deep knowledge of the win32 interface will work on this bug regards christian _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
On 6/14/07, Christian Ulrich <[EMAIL PROTECTED]> wrote: I dont know i have an {$IFDEF MSINDOWS} around it. Another thing that not work are Tab :( But this issue is not long ago. With 0.9.22 it works fine. For now the Tabulator key only work on TDBGrid not between controls. I hope someone who has deep knowledge of the win32 interface will work on this bug You won´t like my comment, but when I see a regression that is problematic to me, and I don´t fell like looking into lcl code to see what happened, I just make sucessive tests until I isolate which revision created the problem. Say you have r100 for Lazarus 0.9.22 and then we are at r200. I test r150, if it works, then I test r175 and sucessively until I find which revision broke it =) Then I have the diff with viewcvs, which gives me the exact cause and it´s usually trivial to fix then. And if it isn´t, this is a great information for the bug report. Of course this is much easier if you have a powerful computer, so rebuilding LCL will be quick. thanks, -- Felipe Monteiro de Carvalho _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Please look at my bugreport before you try to teach me... I have created the bug report short after the problem happens the first time and telled the dates between it happends. I think it are 4 revisions between them... this is over an year ago, nobody was interested in this bug. sorry my knowledge is not deep enougth to fix this. Christian Felipe Monteiro de Carvalho schrieb: On 6/14/07, Christian Ulrich <[EMAIL PROTECTED]> wrote: I dont know i have an {$IFDEF MSINDOWS} around it. Another thing that not work are Tab :( But this issue is not long ago. With 0.9.22 it works fine. For now the Tabulator key only work on TDBGrid not between controls. I hope someone who has deep knowledge of the win32 interface will work on this bug You won´t like my comment, but when I see a regression that is problematic to me, and I don´t fell like looking into lcl code to see what happened, I just make sucessive tests until I isolate which revision created the problem. Say you have r100 for Lazarus 0.9.22 and then we are at r200. I test r150, if it works, then I test r175 and sucessively until I find which revision broke it =) Then I have the diff with viewcvs, which gives me the exact cause and it´s usually trivial to fix then. And if it isn´t, this is a great information for the bug report. Of course this is much easier if you have a powerful computer, so rebuilding LCL will be quick. thanks, _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Placing a form in another form at runtime is sometimes more useful than frames since forms have more properties and events than frames and they can be reparented easily inside other forms, if you have 5 forms which contain the same frame and exist at the same time but are not visible simultaneously one can use less memory by just reparenting a form instead of having more frames. Razvan _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Razvan Adrian Bogdan wrote: Placing a form in another form at runtime is sometimes more useful than frames since forms have more properties and events than frames Then frames should be extended. Having more porperties is not an issue, having more usefull properties is. and they can be reparented easily inside other forms, if you have 5 forms which contain the same frame and exist at the same time but are not visible simultaneously one can use less memory by just reparenting a form instead of having more frames. This can be done also with frames, so I don't see the advantage. IMO a form is a top level widget and should not be embedded in another widget. Marc _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
On 09/07/07, Marc Weustink <[EMAIL PROTECTED]> wrote: > Placing a form in another form at runtime is sometimes more useful > than frames since forms have more properties and events than frames Then frames should be extended. Having more porperties is not an issue, having more usefull properties is. The problem with frames, and Borland mentions this issue as well, is when does it fire a OnCreate event. Borland could never find a reliable time, so instead removed the OnCreate event completely. So whenever you used frames you have to create your own Initialization and Finalization methods and call them manually before and after you use the frame. Frames don't have a OnCreate event like forms do. Using Forms at runtime gives you a uniform/consistent design. Regards, - Graeme - _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Graeme Geldenhuys wrote: On 09/07/07, Marc Weustink <[EMAIL PROTECTED]> wrote: > Placing a form in another form at runtime is sometimes more useful > than frames since forms have more properties and events than frames Then frames should be extended. Having more porperties is not an issue, having more usefull properties is. The problem with frames, and Borland mentions this issue as well, is when does it fire a OnCreate event. Borland could never find a reliable time, so instead removed the OnCreate event completely. So whenever you used frames you have to create your own Initialization and Finalization methods and call them manually before and after you use the frame. Frames don't have a OnCreate event like forms do. Using Forms at runtime gives you a uniform/consistent design. And why do you think a form.OnCreate would fire at the right moment ? Marc _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
On 09/07/07, Marc Weustink <[EMAIL PROTECTED]> wrote: And why do you think a form.OnCreate would fire at the right moment ? Well, using embedded forms at runtime... you create the form when you need the form. At which point the OnCreate fires. Frames are meant for usage at design time, so you have no control at runtime, as to when it was created. Graeme. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
And why do you think a form.OnCreate would fire at the right moment ? Well, using embedded forms at runtime... you create the form when you need the form. At which point the OnCreate fires. Frames are meant for usage at design time, so you have no control at runtime, as to when it was created. I agree and share the same opinion that Graeme, I use extensivelly form creation at runtime, and I had to drop the TFrame and use embedded TForm. []s Cesar Romero _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Cesar Romero wrote: And why do you think a form.OnCreate would fire at the right moment ? Well, using embedded forms at runtime... you create the form when you need the form. At which point the OnCreate fires. Frames are meant for usage at design time, so you have no control at runtime, as to when it was created. I agree and share the same opinion that Graeme, I use extensivelly form creation at runtime, and I had to drop the TFrame and use embedded TForm. In my current project I do the same with frames, so whats the differnece ? Marc _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
I agree and share the same opinion that Graeme, I use extensivelly form creation at runtime, and I had to drop the TFrame and use embedded TForm. In my current project I do the same with frames, so whats the differnece ? Marc, Good for you, as I told I think that work with forms I have more control with less work, but is just my humble opinion. []s Cesar Romero _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
On Mon, 9 Jul 2007, Graeme Geldenhuys wrote: > On 09/07/07, Marc Weustink <[EMAIL PROTECTED]> wrote: > > > > And why do you think a form.OnCreate would fire at the right moment ? > > > > Well, using embedded forms at runtime... you create the form when you > need the form. At which point the OnCreate fires. Frames are meant > for usage at design time, so you have no control at runtime, as to > when it was created. Why not ? I have extensive experience with embedded forms: we use embedded forms only in my applications (About 800 forms). I use them since 8 years (in Delphi, admittedly). After all that time, I'm in a position to say that we have regretted this decision on many occasions. Unfortunately, Frames did not exist in Delphi when we started our development, or we would have used them. Unfortunately, we have too much forms meanwhile, otherwise I would have switched to frames at once. Many events of TForm simply do not work when the form is embedded: - OnShow - OnClose - OnCloseQuery - OnKeyPress in combination with KeyPreview and I forget a lot of them. Many properties of TForm simply don't make sense when the form is embedded: formstyle and the like. "Scaled" is the biggest evil around. With TFrame, on the other hand, you have everything under control. You can add as many properties or events as you like, and you can completely define when these events are fired. The 'useless' properties are not there, so they will not get used erroneously. So my advice is: - By all means, stick with TFrame - Create a TCustomFrame descendent which adds any events/properties you need, and use that exclusively. Register it in the IDE so you can visually design it. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Cesar Romero wrote: > >> And why do you think a form.OnCreate would fire at the right moment ? > > > > Well, using embedded forms at runtime... you create the form when you > > need the form. At which point the OnCreate fires. Frames are meant > > for usage at design time, so you have no control at runtime, as to > > when it was created. > > I agree and share the same opinion that Graeme, I use extensivelly form > creation at runtime, and I had to drop the TFrame and use > embedded TForm. Same here! TFrame is useless when the widget-set supports embedding TForm. Also, embedding out-of-process TForms is indispensable, but not all widget-sets support this; gtk currently doesn't. Thanks! -- Al _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] form embedded in another form
Reparenting forms is nice indeed, however if the widgetset does not allow this we really have to extend frames to have more form like behaviour, OnShow event does trigger in Delphi embedded forms, some events do not, but it is useful, reparenting Forms is useful in other cases too but i'm not sure if it's possible in Laz to have a form in a dll and reparenting it on another form ... and of course there are other uses to reparenting forms that i can't think of at the moment. Razvan _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives