EVT_KILL_FOCUS not working in wxMac 2.4.2.4 on spin controls....

Is this just my local build, or is anyone else seeing this as well? I can not get any EVT_KILL_FOCUS events to trigger from spin controls. Here is a little sample code with a text control and a spin control. The event fires for the text control, but never for the spin control.

Thanks!

#!/usr/bin/env python
# generated by wxGlade 0.3.2 on Mon May 3 12:45:08 2004

import wx

class MyFrame(wx.Frame):
     def __init__(self, *args, **kwds):
         # begin wxGlade: MyFrame.__init__
         kwds["style"] = wx.DEFAULT_FRAME_STYLE
         wx.Frame.__init__(self, *args, **kwds)
         self.spin_ctrl_1 = wx.SpinCtrl(self, -1, "", min=0, max=100)
         self.text_ctrl_1 = wx.TextCtrl(self, -1, "")

         self.__set_properties()
         self.__do_layout()
         # end wxGlade
         self.__set_events()

     def __set_events(self):
         wx.EVT_KILL_FOCUS(self.text_ctrl_1, self.t1)
         wx.EVT_KILL_FOCUS(self.spin_ctrl_1, self.s1)

     def t1(self, evt):
         print "t1 lost focus"

     def s1(self, evt):
         print "s1 lost focus"

     def __set_properties(self):
         # begin wxGlade: MyFrame.__set_properties
         self.SetTitle("frame_1")
         self.SetSize((160, 110))
         # end wxGlade

     def __do_layout(self):
         # begin wxGlade: MyFrame.__do_layout
         sizer_1 = wx.BoxSizer(wx.VERTICAL)
         sizer_1.Add(self.spin_ctrl_1, 0, wx.ALL, 10)
         sizer_1.Add(self.text_ctrl_1, 0, wx.ALL, 10)
         self.SetAutoLayout(1)
         self.SetSizer(sizer_1)
         self.Layout()
         # end wxGlade

# end of class MyFrame

class MyApp(wx.App):
     def OnInit(self):
         wx.InitAllImageHandlers()
         frame_1 = MyFrame(None, -1, "")
         self.SetTopWindow(frame_1)
         frame_1.Show(1)
         return 1

# end of class MyApp

if __name__ == "__main__":
     app = MyApp(0)
     app.MainLoop()

I don't see any focus events on wxMAC wxPython 2.5.1.5. I also see double focus messages with wxSpinCtrl on Win2K.

Both of these issues might be due to a bug with wxSpinCtrl being a compound control. Just a guess.

Please don't cross-post.

ka

···

On May 3, 2004, at 11:01 AM, Steven Palm wrote:

Is this just my local build, or is anyone else seeing this as well? I can not get any EVT_KILL_FOCUS events to trigger from spin controls. Here is a little sample code with a text control and a spin control. The event fires for the text control, but never for the spin control.

Thanks!

#!/usr/bin/env python
# generated by wxGlade 0.3.2 on Mon May 3 12:45:08 2004

import wx

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.spin_ctrl_1 = wx.SpinCtrl(self, -1, "", min=0, max=100)
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
        self.__set_events()

    def __set_events(self):
        wx.EVT_KILL_FOCUS(self.text_ctrl_1, self.t1)
        wx.EVT_KILL_FOCUS(self.spin_ctrl_1, self.s1)

    def t1(self, evt):
        print "t1 lost focus"

    def s1(self, evt):
        print "s1 lost focus"

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        self.SetSize((160, 110))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(self.spin_ctrl_1, 0, wx.ALL, 10)
        sizer_1.Add(self.text_ctrl_1, 0, wx.ALL, 10)
        self.SetAutoLayout(1)
        self.SetSizer(sizer_1)
        self.Layout()
        # end wxGlade

# end of class MyFrame

class MyApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        frame_1 = MyFrame(None, -1, "")
        self.SetTopWindow(frame_1)
        frame_1.Show(1)
        return 1

# end of class MyApp

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()

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

Okay, but how do you get attention of people who may only frequent one list?

  I've spent a fair amount of time trying to track this issue down, and it's the underlying cause why wxGlade isn't working right on the Mac, so I am trying to cover my bases and find an answer.

···

On May 3, 2004, at 1:27 PM, Kevin Altis wrote:

Please don't cross-post.

EVT_SPINCTRL events do get sent when the buttons are activated, as per the docs.

  EVT_TEXT events do NOT get generated when the text field is changed, the docs say they should.

  Is this behavior the same in 2.5?

···

On May 3, 2004, at 1:27 PM, Kevin Altis wrote:

I don't see any focus events on wxMAC wxPython 2.5.1.5. I also see double focus messages with wxSpinCtrl on Win2K. Both of these issues might be due to a bug with wxSpinCtrl being a compound control. Just a guess.