Dialog Button Sizer Workaround

Here http://trac.wxwidgets.org/ticket/11413 I see that the issue with NO
buttons made with CreateButtonSizer() not working is a known issue. What is
the best work around to have ShowModal() return wx.ID_NO when these buttons
are pressed?

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Dialog-Button-Sizer-Workaround-tp5717026.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Hi,

dialogtest.py (1.05 KB)

···

On 20/04/2013 07:40, womesiete wrote:

Here wxTrac has been migrated to GitHub Issues - wxWidgets I see that the issue with NO
buttons made with CreateButtonSizer() not working is a known issue. What is
the best work around to have ShowModal() return wx.ID_NO when these buttons
are pressed?

Save it in a variable and check that see attached.

Frankly I was surprised that "result" after clicking on "No" in the attached was "wx.ID_YES" and not "wx.ID_NO" therefore the variable.

Werner

Thank you that would work, but wouldn't using self.EndModal(wx.ID_NO) in the
bound event be cleaner? That is what I have been using, but I wanted to know
if there was some common standard method in case there is some problem with
EndModal() that I did not know about.

I'm using a class that takes the button combination in the constructor, so
keeping a default value in that way would need to be more complicated with
three or more buttons.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Dialog-Button-Sizer-Workaround-tp5717026p5717029.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Thank you that would work, but wouldn't using self.EndModal(wx.ID_NO) in the
bound event be cleaner?

Yes, I didn't know about that one.

  That is what I have been using, but I wanted to know
if there was some common standard method in case there is some problem with
EndModal() that I did not know about.

I'm using a class that takes the button combination in the constructor, so
keeping a default value in that way would need to be more complicated with
three or more buttons.

I am not sure I understand, sure the more buttons the more options/complicated.

What has the default value to do here?

If you use a common button handler you could maybe use this "EndModal(evt.GetId())".

Werner

···

On 20/04/2013 10:16, womesiete wrote: