This is a problem that I’ve been banging my head against for a while, but just can’t seem to come up with a solution. How would one dismiss a dialog if the user clicks in some area that is not within the dialog?
I started off with having the dialog CaptureMouse() to detect the click, but if I do that, none of the buttons on my dialog see any events. Of course, though, without the CaptureMouse(), I don’t ever see the click event. It seems like this should be simple, but I’m just not seeing it
Background:
I basically have a “tool palette” that I want to behave like a menu. Clicking on a button in the toolbar displays the palette just underneath, and the user can click one of the buttons, or click off of the “tool palette” in order to dismiss without doing anything (like a menu).
This is a problem that I’ve been banging my head against for a while, but just can’t seem to come up with a solution. How would one dismiss a dialog if the user clicks in some area that is not within the dialog?
I started off with having the dialog CaptureMouse() to detect the click, but if I do that, none of the buttons on my dialog see any events. Of course, though, without the CaptureMouse(), I don’t ever see the click event. It seems like this should be simple, but I’m just not seeing it
Thank you very much CM; I tried it, and it certainly does work! I had shied away from it, thinking that it didn’t work under OSX. I had a hazy recollection that there were inherent problems with using PopupTransientWindow under OSX…I’m not sure why. So a follow-up question; as far as anyone knows, wx.PopupTransientWindow has no issues under OSX? When I use it, it seems to work fine. (wx 2.9.1.1-carbon IIRC)
Thanks again,
···
On Sunday, August 5, 2012 10:04:08 PM UTC-4, Che M wrote:
This is a problem that I’ve been banging my head against for a while, but just can’t seem to come up with a solution. How would one dismiss a dialog if the user clicks in some area that is not within the dialog?
I started off with having the dialog CaptureMouse() to detect the click, but if I do that, none of the buttons on my dialog see any events. Of course, though, without the CaptureMouse(), I don’t ever see the click event. It seems like this should be simple, but I’m just not seeing it
Have you tried using wx.PopupTransientWindow? It does exactly this. See the Demo.
But that’s a long time ago and 2.9 has lots of improvements, so I’m guessing it was just fixed. Robin will probably know where to look in the bug tracker. I wasn’t able to find anything useful on this topic except some weird stuff about the date picker.
Mike
···
On Monday, August 6, 2012 8:41:00 AM UTC-5, dhyams wrote:
Thank you very much CM; I tried it, and it certainly does work! I had shied away from it, thinking that it didn’t work under OSX. I had a hazy recollection that there were inherent problems with using PopupTransientWindow under OSX…I’m not sure why. So a follow-up question; as far as anyone knows, wx.PopupTransientWindow has no issues under OSX? When I use it, it seems to work fine. (wx 2.9.1.1-carbon IIRC)