I’ve been stumped by a problem with modal dialogs: I need to be able to raise an existing frame above a modal dialog (in response to a button event), and restore the dialog later. On Mac, this just works - I call frame.Raise() and frame.MakeModal(True), and clicking on the dialog again restores modality. On Linux, an additional button click which triggers frame.MakeModal(False) is required to make this happen. This is a little clumsy and unintuitive right now. Is there a standard method of “faking” a modal dialog, i.e. one that still has a ShowModal method with the same behavior, except it isn’t actually modal?
thanks,
Nat
Nathaniel Echols wrote:
I've been stumped by a problem with modal dialogs: I need to be able
to raise an existing frame above a modal dialog (in response to a
button event), and restore the dialog later. On Mac, this just works
- I call frame.Raise() and frame.MakeModal(True), and clicking on the
dialog again restores modality. On Linux, an additional button click
which triggers frame.MakeModal(False) is required to make this happen.
This is a little clumsy and unintuitive right now. Is there a
standard method of "faking" a modal dialog, i.e. one that still has a
ShowModal method with the same behavior, except it isn't actually modal?
Why are you thinking of it as a modal dialog at all? Why not just make
it non-modal to begin with? What do you gain?
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
I gain the convenience of using ShowModal to get return values from dialogs, and given how deeply that functionality is embedded in my code, I’d prefer to retain it if possible. I’ve also written much of my code with the assumption that changes made in dialogs won’t be processed until the dialog is closed. There are actually many other assumptions involved here, which is why I tried to preserve genuine modality. For instance, most of the dialogs are opened through menu events; if a dialog is modal, the menus are disabled, otherwise it would be possible to open a duplicate dialog, which would certainly break something. The program doesn’t have to work this way but it made perfect sense at the time and required less code.
There is also the issue of validation, but I don’t know enough to tell if that will break the way I currently use it. But ultimately the main reason is that I’ve already written it this way, and I don’t like bloating my code to deal with cross-platform inconsistencies. I will probably have to do this anyway to deal with the loss of modality on Linux, but using a drop-in non-modal replacement for modal dialogs will at least minimize the amount of recoding that I need to do.
···
On Fri, Apr 10, 2009 at 1:53 PM, Tim Roberts timr@probo.com wrote:
Nathaniel Echols wrote:
I’ve been stumped by a problem with modal dialogs: I need to be able
to raise an existing frame above a modal dialog (in response to a
button event), and restore the dialog later. On Mac, this just works
- I call frame.Raise() and frame.MakeModal(True), and clicking on the
dialog again restores modality. On Linux, an additional button click
which triggers frame.MakeModal(False) is required to make this happen.
This is a little clumsy and unintuitive right now. Is there a
standard method of “faking” a modal dialog, i.e. one that still has a
ShowModal method with the same behavior, except it isn’t actually modal?
Why are you thinking of it as a modal dialog at all? Why not just make
it non-modal to begin with? What do you gain?