Forum > General

ShowModal disables form minimise

<< < (3/5) > >>

lucamar:

--- Quote from: Martin_fr on May 06, 2021, 07:38:19 pm ---I just wonder what a modal dialog, with a minimize button on the actual modal form would do?
--- End quote ---

Test it yourself! ;)
In Linux (Xubuntu 18.04), the second option is taken: it minimizes the modal form, and leaves the "frozen" app on the screen.

mercurhyo:

--- Quote from: Martin_fr on May 06, 2021, 06:35:44 pm ---
--- Quote from: mercurhyo on May 06, 2021, 06:21:15 pm --- I didn't know OS buttons enable/disable concept and maybe it has issues depending the Widgetset/Platform, but I do remember I was used to set bsDialog style on all my projects while using ShowModal. Then it worked fine

--- End quote ---

You mean you set your main form to bsDialog, if you show some modal form?

Modalforms themself should probably be bsDialog. I do not know if it is strictly required. I also do not know what happens otherwise, maybe its enforced.  But that should not affect the main form.

From memory, the code in ShowModal runs through all the other (none modal) forms, and prepares them for being "behind" the modal form. And all those changes should be reverted when the modal form exits.

--- End quote ---

where the hell did you read that i use showmodal on mainform? LOOOL i said on each form where i use showmodal thats a BIG difference.

NOW I can explain you HOW it works :
when an application enters a modal mode it recursively calls the "processmessages" of itself incrementing reference counter of the deepness of modal and giving the Handle of the desired form ... meaning a modal form can open a modal form that can open a mo... and so on.
When all modal forms are closed the processmessages func of the application object is switched back to mainform
ENJOY

and remember "debugger is your friend" LOOOL!!!

llion:
Thank you for your replies.

I confirm that setting formC.borderstyle to bsDialog does not make the problem go away.

If I use the debugger then the minimise capability on formB is disabled when formC is closed; if I do not use the debugger then this is disabled earlier, when formC is displayed. I confirm that this remains disabled once formC is closed. I have also seen instances where it is formA that loses its minimise button, but I cannot yet recreate this although I suspect that it is related.

A further unexpected behaviour is that when formC is closed it is formA which receives focus, where I would expect this to be formB.

I'm afraid that my limited Lazarus skills have taken me as far as I can get with debugging this problem. I am now working in my various apps to add code to identify explicitly which form has focus whenever a ShowModal is executed (ie formB in my example), and to explicitly re-enable the minimise function on this form when the modal form is closed.

winni:
Hi!

For FormC:

Set the property "ShowInTaskBar" to "stalways".

If you now minimize FormC you got 2 Icons in the Taskbar. One is FormC.

Winni

llion:
as a postscript :

In my example, if formA has 2 buttons, one button to show formB, and then a second button to showmodal formC, then it is formA that loses its minimize button/menu option. This is more serious - I can no longer minimize my app. Sigh. I wonder whether this is why Lazarus itself cannot be minimized?

And the only way of restoring this lost minimize button is to close & reopen the app. It seems not possible to change programmatically the Tform.BorderIcons property at runtime, although that is exactly what this bug in ?Lazarus appears to be doing successfully. Sigh again.

I wondered about reporting  these (sic) bugs but I found the bugtracker pages impenetrable.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version