Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-09

Showmodal trouble

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Sebastian Kraft

Hello,

have some trouble with Form.ShowModal...

Form1:= TForm1.create;
Form1.ShowModal;

Should bring Form1 to front, keep it on top of all other project forms and stay there until it is closed. Is this right?

But sometimes when I click on the Mainform behind Form1 Mainform comes to front and Form1 is hidden behind it.... I am using GTK2 widgetset from svn.

Am I doing something wrong calling ShowModal? Or is it a bug?

regards,
sebastian

Reply by email

Graeme Geldenhuys
to Sebastian Kraft: have some trouble with Form.ShowModal... Form1:= TForm1.create; Form1.ShowModal; Should…
Sebastian Kraft wrote
But sometimes when I click on the Mainform behind Form1 Mainform comes to front and Form1 is hidden behind it.... I am using GTK2 widgetset from svn.

Under Linux, Modal forms and "stay on top" are simply requests to the window manager. Not all windows managers are equal, and will not always act on your request.

You will find that in the case of Modal forms, you might be able to click and bring focus to other non-modal forms, but you shouldn't be able change anything in those forms.

What Window Manager are you using?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Sebastian Kraft
to Graeme Geldenhuys: Under Linux, Modal forms and "stay on top" are simply requests to the window manager. Not…
Graeme Geldenhuys wrote 13 lines
On 9/17/08, Sebastian Kraft wrote: > But sometimes when I click on the Mainform behind Form1 Mainform comes > to front and Form1 is hidden behind it.... I am using GTK2 widgetset from > svn. Under Linux, Modal forms and "stay on top" are simply requests to the window manager. Not all windows managers are equal, and will not always act on your request. You will find that in the case of Modal forms, you might be able to click and bring focus to other non-modal forms, but you shouldn't be able change anything in those forms.

exactly... all other forms are disabled. So if I loose focus on my modal form it is quite difficult to bring it back because the modal form is not in taskbar...

Reply by email

Bogusław Brandys
to Sebastian Kraft

Sebastian Kraft pisze:

Show quoted text 17 lines
Am Mittwoch, 17. September 2008 14:30:54 schrieb Graeme Geldenhuys: > On 9/17/08, Sebastian Kraft wrote: >> But sometimes when I click on the Mainform behind Form1 Mainform comes >> to front and Form1 is hidden behind it.... I am using GTK2 widgetset from >> svn. > Under Linux, Modal forms and "stay on top" are simply requests to the > window manager. Not all windows managers are equal, and will not > always act on your request. > > You will find that in the case of Modal forms, you might be able to > click and bring focus to other non-modal forms, but you shouldn't be > able change anything in those forms. > exactly... all other forms are disabled. So if I loose focus on my modal form it is quite difficult to bring it back because the modal form is not in taskbar... _______________________________________________

That recalls me similar bug under Windows (I suspect it is regression because long time ago when I coded OnMinimize/OnMaximize events it was working well) - if you show modally dialog or form and close it focus is not returned to previous one (even if it's main form), so working using keyboard is very difficult now.

Regards
Boguslaw

Reply by email

Graeme Geldenhuys
to Sebastian Kraft: exactly... all other forms are disabled. So if I loose focus on my modal form it is quite…
Sebastian Kraft wrote 7 lines
> You will find that in the case of Modal forms, you might be able to > click and bring focus to other non-modal forms, but you shouldn't be > able change anything in those forms. > exactly... all other forms are disabled. So if I loose focus on my modal form it is quite difficult to bring it back because the modal form is not in taskbar...

Then it must be a bug in the toolkit (LCL or even GTK2). For example in fpGUI - You can set focus to other non-modal forms and move them (but no editing), while a modal form is showing, but the modal form is always above it's Parent form. If you click on the parent form, the model form will appear above it. So you don't have the issue of not "finding" the modal form again.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Sebastian Kraft
to Graeme Geldenhuys
Graeme Geldenhuys wrote
On Wed, Sep 17, 2008 at 3:51 PM, Sebastian Kraft
Show quoted text 14 lines
>> You will find that in the case of Modal forms, you might be able to >> click and bring focus to other non-modal forms, but you shouldn't be >> able change anything in those forms. > > exactly... all other forms are disabled. So if I loose focus on my modal > form it is quite difficult to bring it back because the modal form is not > in taskbar... Then it must be a bug in the toolkit (LCL or even GTK2). For example in fpGUI - You can set focus to other non-modal forms and move them (but no editing), while a modal form is showing, but the modal form is always above it's Parent form. If you click on the parent form, the model form will appear above it. So you don't have the issue of not "finding" the modal form again.

Ok... I will create a bug report.

any ideas for a fast workaround? The problem with the modal form getting lost behind other forms occurs most times only on the first ShowModal every program run.

Reply by email

John vd Waeter
to Sebastian Kraft
any ideas for a fast workaround? The problem with the modal form getting lost behind other forms occurs most times only on the first ShowModal every program run.

I suppose the dialogs are not created on-the-fly... Hmmm... the most ugly workaround I can think of:

1. Put a timer on any form that is to be shown Modal
2. Start the timer in the onshow-event IF a flag is set.
    When the timer fires, close the form.
3. Call all your dialogs when the main-program starts:
    with thedialog do
     begin
      SetTheFlag;
      ShowModal;
     end;

Should work if things happen only at the first Showmodal. Now every form has had its first showmodal.

Speaking of workarounds.... ;-)

goodluck!
John

Reply by email

Sebastian Kraft
to Sebastian Kraft: have some trouble with Form.ShowModal... Form1:= TForm1.create; Form1.ShowModal; Should…
Sebastian Kraft wrote 13 lines
Hello, have some trouble with Form.ShowModal... Form1:= TForm1.create; Form1.ShowModal; Should bring Form1 to front, keep it on top of all other project forms and stay there until it is closed. Is this right? But sometimes when I click on the Mainform behind Form1 Mainform comes to front and Form1 is hidden behind it.... I am using GTK2 widgetset from svn.

I found out that it is the same problem with dialogs that are created using ShowMessage(); They also get hidden behind the main form.

Have created a bug report this morning.

Sebastian

Reply by email