Button event fires twice!

For some reason EVT_BUTTON is firing twice whenever I click the button.

Does anyone know why this would occur? Or, how to fix it? If I change it to left button down, it only fires once, but then takes the focus away from the window that opens as a result of the event.
If you need me to post more of the code, please let me know.

Thanks.

(Windows XP; python 2.2.3; wxPython 2.4)

        self.cmdAddHist = wxButton(id=wxID_WXCHALLOPPDETAILCMDADDHIST,
              label='Add Action History', name='cmdAddHist', parent=self,
              pos=wxPoint(632, 488), size=wxSize(135, 28), style=0)
        EVT_BUTTON(self.cmdAddHist, wxID_WXCHALLOPPDETAILCMDADDHIST,
              self.OnCmdaddhistButton)

Hi Rahl,

In your self.OnCmdaddhistButton you are not doing an event.Skip() by any chance?

See you
Werner

Rahl wrote:

···

For some reason EVT_BUTTON is firing twice whenever I click the button.

Does anyone know why this would occur? Or, how to fix it? If I change it to left button down, it only fires once, but then takes the focus away from the window that opens as a result of the event.

If you need me to post more of the code, please let me know.

Thanks.

(Windows XP; python 2.2.3; wxPython 2.4)

       self.cmdAddHist = wxButton(id=wxID_WXCHALLOPPDETAILCMDADDHIST,
             label='Add Action History', name='cmdAddHist', parent=self,
             pos=wxPoint(632, 488), size=wxSize(135, 28), style=0)
       EVT_BUTTON(self.cmdAddHist, wxID_WXCHALLOPPDETAILCMDADDHIST,
             self.OnCmdaddhistButton)

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

hi robin,

is the name space migration complete in 2.4.2? thanks.

Philip

Rahl wrote:

For some reason EVT_BUTTON is firing twice whenever I click the button.

Does anyone know why this would occur? Or, how to fix it? If I change it to left button down, it only fires once, but then takes the focus away from the window that opens as a result of the event.

If you need me to post more of the code, please let me know.

Thanks.

(Windows XP; python 2.2.3; wxPython 2.4)

       self.cmdAddHist = wxButton(id=wxID_WXCHALLOPPDETAILCMDADDHIST,
             label='Add Action History', name='cmdAddHist', parent=self,
             pos=wxPoint(632, 488), size=wxSize(135, 28), style=0)
       EVT_BUTTON(self.cmdAddHist, wxID_WXCHALLOPPDETAILCMDADDHIST,
             self.OnCmdaddhistButton)

Try binding EVT_BUTTON to self instead of self.cmdAddHist.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

redpineseed wrote:

hi robin,

is the name space migration complete in 2.4.2? thanks.

No, 2.4.2 only has the first phase implemented. The classes and other items are really named with the wx prefix and live in the wxPython package. The wx package is composed of modules that import from the wxPython package and strip off the wx prefix dynamically.

In 2.5 the second phase of the transition is being implemented. The real classes and such are named without the wx prefix and they live in the wx package. The wxPython package now has modules that import from wx and reassign names with the wx prefix put back on. I'm calling these the reverse renamers.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!