I converted by Main Menu from a wx.Frame to a wx.Dialog
Old
[code]
class Menu_2(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Menu_2.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
[/code]
New
[code]
class Menu_2(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: Menu_2.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
[/code]
I have one text Control that is there to recieve a numeric selection.
The old Binding
[code]
self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
self.Bind(wx.EVT_TEXT_ENTER, self.TextEnter, self.text_ctrl_1)
[/code]
Works in a wx.Frame and the [Enter] key triggers the event and I can
check the value of the entry and act accordingly.
Does *NOT* work in a wx.Dialog. I get no indication that any event is
being triggered by the [Enter] key whatsoever.
Can I use a TextControl in a wx.Dialog and trigger in the [Enter] Key?
If not, is there anyway to implement this without resorting to
creating a menu all out of buttons?
I am using Python 2.7.2 and wxPython 2.8.??
Thanks
BTW the code for the handler is
[code]
def TextEnter(self, event): # wxGlade: Menu_2.<event_handler>
# print "Number of Modules: %d " %int(TC_Config.Test_Modules)
# print self.text_ctrl_1.GetValue()
if int(self.text_ctrl_1.GetValue()) <= 0:
print "Input Value Not Supported - Too Low"
elif int(self.text_ctrl_1.GetValue()) == 98:
print "Input Value Supported - Exit Selected"
Test_Control.LogScrn.Destroy()
self.Destroy()
elif int(self.text_ctrl_1.GetValue()) >
int(TC_Config.Test_Modules):
print "Input Value Not Supported - Too High"
elif int(TC_Config.Test_Modules) <=
int(self.text_ctrl_1.GetValue()):
print "Input Value Supported - Test Selection Valid"
# Need to Add Safe To Turn On Test and UUT Power Up PRIOR
to
# Starting any tests.
if TC_Config.STTO == False:
print "STTO is False"
TC_Config.STTO = self.SafeToTurnOn()
if TC_Config.STTO == True:
print "STTO is True"
TC_Config.CurrentModule =
int(self.text_ctrl_1.GetValue())
self.Module_Launcher()
self.text_ctrl_1.SetValue("")
event.Skip()
[/code]