On 1/8/13 1:51 PM, Carey Gagnon wrote:
> I've had this piece of code that I snipped from somewhere but it never
> really has worked. I looked in the dKeys.py file but don't see the keyCodes.
> 
> Here my code:
> 
> ## *!* ## Dabo Code ID: dTextBox-dPanel-271
> def onKeyChar(self, evt):
>     if evt.keyCode == 13:
>         self.Form.search()
>     else:                                        ############# This and
> next line added to see if it was even responding to the keyboard
>         print "is this thing firing?
> 
> 
> The else print part was added just to see if it was firing at all. Which it
> does with every key press when typing search term into the dTextBox.
> 
> I probably have the wrong key code or something.

The problem is that the enter key isn't processed on Windows by default. Put a 
print
statement at the top of the function like:

print "!", evt.keyCode

And you'll see that when you press enter, you don't see the print statement.

There's a way around this, but it isn't wrapped in Dabo. In your 
initProperties()
method for the textbox, put this code:

  import wx
  self._addWindowStyleFlag(wx.TE_PROCESS_ENTER)

Paul

_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/50ec9675.5010...@ulmcnett.com

Reply via email to