#!python
## Windows 7 and 2.9.5.0 msw (classic)
##
## PROBLEM ##
## 
## Pressing Enter in wx.DatePickerCtrl will not move forwarded to next field
##
import sys
import wx
import traceback ## to debug methods
from wx.lib.masked import TextCtrl  
from wx.lib.masked import NumCtrl 

print wx.version()

def show_error():
    #if any one, new to wxpython and want to show errors in a window
    #those can use this function
    message = ''.join(traceback.format_exception(*sys.exc_info()))
    dialog = wx.MessageDialog(None, message, 'Error!', wx.OK|wx.ICON_ERROR)
    dialog.ShowModal()

class MyForm( wx.Frame) :
    def __init__(self,parent,title) :
        wx.Frame.__init__(self,parent,size =(300,200),title=title)
        panel=wx.Panel(self)
        
        lb0=wx.StaticText(panel,label="Name")
        nm=TextCtrl(panel,style=wx.TE_PROCESS_ENTER)
        
        lb1=wx.StaticText(panel,label='Date of Birth')
        dt1=wx.DatePickerCtrl(panel, style=wx.TE_PROCESS_ENTER)
        
        lb2=wx.StaticText(panel,label='Place')
        place=TextCtrl(panel,style=wx.TE_PROCESS_ENTER)
        
        dt1.Bind(wx.EVT_KEY_DOWN,self.KeyDown)
        dt1.Bind(wx.EVT_TEXT_ENTER,self.Enter)
        
        fsz=wx.FlexGridSizer(4,2,5,5)
        
        fsz.Add(lb0,0,0,0)
        fsz.Add(nm,0,0,0)
        fsz.Add(lb1,0,0,0)
        fsz.Add(dt1,0,0,0)
        fsz.Add(lb2,0,0,0)
        fsz.Add(place,0,0,0)
        
        panel.SetSizerAndFit(fsz)
        
    def KeyDown(self,e) :
        print "key down Event Occured"          
    def Enter(self,e) :
        print "Pressed  Enter Key"          
    
if __name__ == '__main__' :
    app=wx.App(True)
    try :
        frame=MyForm(None,"Press Enter IN wx.DatePickerCtrl")
        frame.Show()
        #if checkAutho() == True :
        app.MainLoop()
    except :
        show_error()
        
    
    
        
        
        
        
        
        
    
