Hi all,
Is it possible to know if a user has clicked or done "Enter" on a button ?
I tried :
btn.Bind(wx.EVT_CHAR, self.EvtChar)
For "F6" key, I go to self.EvtChar, but for "Enter" key, not ...
Friendly.
Hi all,
Is it possible to know if a user has clicked or done "Enter" on a button ?
I tried :
btn.Bind(wx.EVT_CHAR, self.EvtChar)
For "F6" key, I go to self.EvtChar, but for "Enter" key, not ...
Friendly.
Try:
self.Bind(wx.EVT_BUTTON, self.EvtSomething, btn)
---------------------------------------
Ron Shoemaker
---------------------------------------
-----Original Message-----
From: Hugues JEAN-BAPTISTE [mailto:hjb@agorinfo.fr]
Sent: Monday, June 04, 2007 8:56 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Question about events
Hi all,
Is it possible to know if a user has clicked or done "Enter" on a button ?
I tried :
btn.Bind(wx.EVT_CHAR, self.EvtChar)
For "F6" key, I go to self.EvtChar, but for "Enter" key, not ...
Friendly.
--
Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Hi Ronnie, and all,
Thank you, four your answer, but this does not work !...
However, after more analysis, I have found that I don't take the good way to solve the problem.
The problem is exactly the next :
- On a panel, there is a wxTextCtrl and a wxButton.
- When the user enter a barcode (with a scanner) in the wxTextCtrl, the program do many things (1/2 to 1 sec.) and come back to the wxTextCtrl (wxCallAfter(SetFocus), naturaly, the cursor would go to the button).
- Meanwhile, the user read a new barcode
- Sometimes, almost under linux, because the user have read to much quickly a new barcode, the characters of the barcode are lost and the "enter" at the end is taken by the button
Now, I think the best solution would be to keep in a buffer the characters read and to restore them when the cursor come back in the wxTextCtrl after the wxCallAfter(SetFocus) will be done.
But, I don't know how to do this and I don't understand why the character are lost and why the system does not wait the wxCallAfter(SetFocus) was done before accepting characters ?
Hope somebody have a idea ...
Thanks in advance ...
Hugues JEAN-BAPTISTE.
Shoemaker, Ronnie A. a écrit :
Try:
self.Bind(wx.EVT_BUTTON, self.EvtSomething, btn)
---------------------------------------
Ron Shoemaker
--------------------------------------------Original Message-----
From: Hugues JEAN-BAPTISTE [mailto:hjb@agorinfo.fr]
Sent: Monday, June 04, 2007 8:56 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Question about eventsHi all,
Is it possible to know if a user has clicked or done "Enter" on a button ?
I tried :btn.Bind(wx.EVT_CHAR, self.EvtChar)
For "F6" key, I go to self.EvtChar, but for "Enter" key, not ...
Friendly.
--
Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)
Hugues JEAN-BAPTISTE wrote:
Hi Ronnie, and all,
Thank you, four your answer, but this does not work !...
However, after more analysis, I have found that I don't take the good way to solve the problem.
The problem is exactly the next :
- On a panel, there is a wxTextCtrl and a wxButton.
- When the user enter a barcode (with a scanner) in the wxTextCtrl, the program do many things (1/2 to 1 sec.) and come back to the wxTextCtrl (wxCallAfter(SetFocus), naturaly, the cursor would go to the button).
- Meanwhile, the user read a new barcode
- Sometimes, almost under linux, because the user have read to much quickly a new barcode, the characters of the barcode are lost and the "enter" at the end is taken by the button
Sound to me like it would be best to not take so long to do whatever you do before it is ready to take the next entry. Can you grab the data and either save the processing for later, or hand it off to a worker thread?
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!