Can't set the focus on text part of a SpinCtrl on a wxPopupWindow.
I am creating a couple of PopupWindows for my application that hold some controls for changing things on the main panel. Now I want to be able to type numbers in a SpinCtrl but I can't set the focus on the text part of the SpinCtrl and so I can't input any text. The spin buttons themselves work just fine though.
I based my work on the demo (PopupWindow.py in the demo directory of the source code download) which conveniently has a SpinCtrl too. This demo has the exact same behaviour as my own code.
Just to see and test what happens I also added a TextCtrl(1) to the demo to see if it was just SpinCtrl which does not work. But alas, I can't type anything into this TextCtrl either.
Has anybody got an idea on how I can properly type text into these two controls? (And probably every control that uses a text field as part of its make-up.)
I am using wxPython 4.0.1 and Python 2.7. Both installed via Visual Studio 2017's installer and its pypi installer.
Thanks in advance,
(1) I added two lines to the demo in the __init__ function. It looks like this now:
classTestTransientPopup(wx.PopupTransientWindow): """Adds a bit of text and mouse movement to the wx.PopupWindow""" def __init__(self, parent, style, log): wx.PopupTransientWindow.__init__(self, parent, style) self.log = log panel = wx.Panel(self) panel.SetBackgroundColour("#FFB6C1")
st = wx.StaticText(panel,-1, "wx.PopupTransientWindow is a\n" "wx.PopupWindow which disappears\n" "automatically when the user\n" "clicks the mouse outside it or if it\n" "(or its first child) loses focus in \n" "any other way.") btn = wx.Button(panel,-1,"Press Me") spin = wx.SpinCtrl(panel,-1,"Hello", size=(100,-1)) entry = wx.TextCtrl(panel, value="Put text in me.")#Added line btn.Bind(wx.EVT_BUTTON,self.OnButton)
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.