Forum > General
ShowModal disables form minimise
llion:
I am using Lazarus vn 2.0.6 on XUbuntu 18.04.
I have a problem which can be demonstrated easily using a project with just 3 forms : formA, formB, formC. FormA is the main form for the project. With formA visible I execute the following code
formB.show ;
application.processmessages ; // this ensures that formB is displayed in front of formA
{do other stuff not related to forms} ;
formC.showmodal ; // for example to display a message relating to the "other stuff" above
In the course of displaying formC the Minimise button in the title bar of formB, & the corresponding Minimise menu option, become disabled, and remain so until the application is terminated.
This would appear to be a bug with showmodal, since if "formC.showmodal" above is replaced with "formC.show" the problem does not appear. Can anyone suggest a fix or work-around please?
mercurhyo:
BorderStyle property should be set to bsDialog on each form using ShowModal, isn't it?
Martin_fr:
Afaik, While the modal form is open, the minimize on all the other form (formA, formB) should be disabled.
But, when the modal form is closed, the minimize (of formA, formB) should be restored to whatever it's state was before the modal form was opened.
If it is not restored, then that would be a bug.
mercurhyo:
--- Quote from: Martin_fr on May 06, 2021, 06:15:43 pm ---Afaik, While the modal form is open, the minimize on all the other form (formA, formB) should be disabled.
But, when the modal form is closed, the minimize (of formA, formB) should be restored to whatever it's state was before the modal form was opened.
If it is not restored, then that would be a bug.
--- End quote ---
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
Martin_fr:
--- 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.
Navigation
[0] Message Index
[#] Next page