TextControl works in wx.Frame doesn't work in wx.Dialog

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]

Hi,

···

On Wed, Sep 7, 2011 at 9:23 AM, SpiritualMadMan <madrucke@yahoo.com> wrote:

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]

Think you need to pass the wx.TE_PROCESS_ENTER style flag when
creating your TextCtrl.

@see: wxTextCtrl

Cody

Thanks!

That did the trick. If I weren't so overwhelmed with project deadlines
I'd get a chance to actually read through Robin's Book!

Again, Thanks!

···

On Sep 7, 10:41 am, Cody <codyprec...@gmail.com> wrote:

Hi,

On Wed, Sep 7, 2011 at 9:23 AM, SpiritualMadMan <madru...@yahoo.com> wrote:
> 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]

Think you need to pass the wx.TE_PROCESS_ENTER style flag when
creating your TextCtrl.

@see:wxTextCtrl

Cody