473,508 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button and Key Event

lux
Hi,
how to enable EVT_CHAR or EVT_KEY_DOWN in a wxButton?

Thank's, Luca

Mar 15 '06 #1
2 1464
assuming you have a button instantiated and named myButton

in 2.6 (namespace is relevant I think prior to 2.4 you had a diff
namespace for wx) for this example i am guessing you are creating the
button as part of a panel or some other object you are extending (ie
self)

self.myButton.Bind(wx.EVT_KEY_DOWN, self.OnLeftDownHandler )

Make sure you define a method OnLeftDownHandler on the parent object.

As a further thought is this really what you are trying to do?
Or do you want to know if a key is pressed when someone clicks on the
button? Check the mouse events, I know you can check if control or
shift was pressed during a mouse click, not sure if you can do any
arbitrary key. Binding the key event will not accomplish that if that
is what you want to know, well you might be able to torture around to
it if that's what you want. The other problem is the key event should
only register if the button has keyboard focus - kind of an odd
situation. So you may want to place the key listener on the parent
object.
Or you may want to look into creating a custom event. Hope this helps.
Also be warry of behavior of evt_char in windows. Can't remember what,
but there is something funky there - I'm sure that was helpful ;)

Mar 15 '06 #2
lux
Thanks,
I think that the solution for my problem is only to use an
AcceleratorTable.
In this way I can capture the key pressed event
without the "button problem"

Luca

Mar 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1918
by: Girish | last post by:
I have TWO submit buttons of type IMAGE on my asp form. This renders as <input type="image">. I need to be able to eble the ENTER button for both buttons. Yes, I know that for the input type...
11
13854
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
15
61954
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
11
4186
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
8
2011
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7489
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.