Phoenix - window.MakeModal

1 view
Skip to first unread message

Werner

unread,
Apr 21, 2013, 2:15:18 PM4/21/13
to wxpyth...@googlegroups.com
Hi,

This is removed, how to make e.g. a Frame Modal?

Werner

werner

unread,
Apr 21, 2013, 4:38:09 PM4/21/13
to wxpyth...@googlegroups.com

werner

unread,
Apr 21, 2013, 4:38:24 PM4/21/13
to wxpyth...@googlegroups.com

Robin Dunn

unread,
Apr 23, 2013, 9:55:08 PM4/23/13
to wxPyth...@googlegroups.com
Werner wrote:
> Hi,
>
> This is removed, how to make e.g. a Frame Modal?

The wx changes.txt file says:

- wxWindow::MakeModal() is deprecated, use wxDialog::ShowModal()
instead if possible or wxWindowDisabler otherwise.

The method still exists in the code, as long as 2.8 compatibility mode
is turned on, so I could probably still add a deprecated wrapper for it
if there is demand. The reason it is missing now is that it has been
removed from the wx documentation so the Phoenix tools are not seeing it.

--
Robin Dunn
Software Craftsman
http://wxPython.org

werner

unread,
Apr 24, 2013, 4:01:38 AM4/24/13
to wxPyth...@googlegroups.com
I like to have a statusbar in this one, one of the reason to use a Frame
but when it is open by user I want to prevent that they open another one.

I guess wxWindowDisabler would do for that but I can't figure out how to
use it.

I had this and the "calling dialog" was disabled while the frame was open:

viewer = self.getViewer()
viewer.view.MakeModal()
viewer.view.Show()


Tried this, but the "calling dialog" is still enabled:

with wx.WindowDisabler():
viewer = self.getViewer()
viewer.view.Show()


Werner

Robin Dunn

unread,
Apr 25, 2013, 8:18:00 PM4/25/13
to wxPyth...@googlegroups.com
The instance of the disabler needs to exist for as long as the window
should be modal-like. So something like this would work:

def MakeModal(self, modal=True):
if modal and not hasattr(self, '_disabler'):
self._disabler = wx.WindowDisabler(self)
if not modal and hasattr(self, '_disabler'):
del self._disabler

werner

unread,
Apr 26, 2013, 2:24:06 AM4/26/13
to wxPyth...@googlegroups.com
Hi Robin,

On 26/04/2013 02:18, Robin Dunn wrote:
...
>
> The instance of the disabler needs to exist for as long as the window
> should be modal-like. So something like this would work:
>
> def MakeModal(self, modal=True):
> if modal and not hasattr(self, '_disabler'):
> self._disabler = wx.WindowDisabler(self)
> if not modal and hasattr(self, '_disabler'):
> del self._disabler
>
>
Thanks that works great.

Werner
Reply all
Reply to author
Forward
0 new messages