[Lazarus] Comments on rev 36091 / issue #21459

Craig Peterson craig at scootersoftware.com
Thu May 3 04:59:24 CEST 2012

On May 2, 2012, at 7:08 PM, Paul Ishenin wrote:
> Then the applied fix needs to be reimplemented. The need to show a non-modal form on top of modal is needed even for LCL components - for TDateEdit and TCalcEdit as they use forms for dropping down editors. Similar needs exists in many other component sets.

TDateEdit and TCalcEdit both worked correctly prior to the patch.  

TDateEdit is shown non-modally, but its PopupMode is pmAuto, which parents it to the modal form.  Since it's owned by the modal form it works correctly, but stays on top.

TCalcEdit just shows its form using ShowModal.

The original bug reporter was asking for the ability to show a non-modal form while a modal form is active, with the ability for the non-modal form to go into the background.  As far as I can tell, Carbon doesn't support that because SetWindowModality works program-wide.

A possible solution would be to replace the calls to SetWindowModality in  TCarbonWindow.ShowModal and CloseModal with a loop over all of the open forms to manually enable/disable them.  I wouldn't recommend that as change to the official Lazarus distribution though, since it bypasses the OS-provided behavior and would probably have side effects.  It wouldn't be hard to register a custom TCarbonWindow descendant in his application code to do that.  Alternatively, he can just set PopupMode to pmAuto like TDataEdit and accept that the non-modal dialog will stay on top of the modal one.

Craig Peterson
Scooter Software

More information about the Lazarus mailing list