473,652 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form KeyPreview

I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.

Can some one tell me why & how can it be done?

best regards,
habix
Nov 20 '05 #1
13 3843
* "HABJAN ®iga" <habix[AT]intelcom[DOT]si> scripsit:
I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
yust a thought
you might want to get other combinations then the alt+..
Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


are you intercepting the keys on the cbo keypress event?

eric
Nov 20 '05 #3
Client wants to use Alt+hotkey...

I'am acctuayl not using comboboxes, but autocompletecom bobox (inherited from
combo + autocomlete logic).

I intercept keydown in ACCombobox, handle it, and call mybase.keydown. ....
But the form doesn't raise keydown (keypreview)... .

thanks,
habix
"EricJ" <ericRéMo**@Thi Somnipack.be> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


yust a thought
you might want to get other combinations then the alt+..
Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


are you intercepting the keys on the cbo keypress event?

eric


Nov 20 '05 #4
Good thinking....

I'll have this option in mind if i don't find any other solutions (why
should combobox be diferent than other controls)...

Thanks,
habix
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:bq******** *****@ID-208219.news.uni-berlin.de...
* "HABJAN ®iga" <habix[AT]intelcom[DOT]si> scripsit:
I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
Q.) Is the KeyPreview set to true or false.?
Q.) If it is set to True, then the control with focus will not receive the
key events.
Q.) If it is set to false, are other controls receiving the events and only
the ComboBox not receiving ?

OHM
HABJAN ®iga wrote:
I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.

Can some one tell me why & how can it be done?

best regards,
habix


Best Regards - OHMBest Regards - OHM On**********@BT Internet.Com
Nov 20 '05 #6
There is a silly walkaround :o):

Let's assume we wan't to catch alt+o, and we have focus on combobox (that
doesn't fire form's keypreview...)

I created a temp button
(
text = "&oTemp"
size = "0;0"
)

When i press alt+o, the form brings the focus to temporary button
(automatic), and then it raises keydown event.

The trouble is... i lost focus every time i press alt+o (so i have to handle
that too)

re, habix
"HABJAN ®iga" <habix[AT]intelcom[DOT]si> wrote in message
news:bq******** @enews4.newsguy .com...
I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.

Can some one tell me why & how can it be done?

best regards,
habix

Nov 20 '05 #7
I tryed creating some hidden menus, but the shortcut property doesn't
support Alt+Letter (only alt+(0-9) & alt+(f1-f12)), so this walkaround isn't
good.

Any way to intercept key down before all controls?

best re,
habix

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:bq******** *****@ID-208219.news.uni-berlin.de...
* "HABJAN ®iga" <habix[AT]intelcom[DOT]si> scripsit:
I'am using form's keypreview property & keydown (on form) to look for
hotkeys (alt+?)

Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
* "HABJAN Ziga" <habix[AT]intelcom[DOT]si> scripsit:
I'll have this option in mind if i don't find any other solutions (why
should combobox be diferent than other controls)...


Maybe it's an other combobox problem (I heard about similar problems
with this control).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #9
yust thinking here
the key would be cought in the lowest level (in this case your combo)
im thinking in the lines of catching errors

try
try
error
catch
'youll get the error here
end try
catch
'nothing here
end try

"HABJAN ®iga" <habix[AT]intelcom[DOT]si> wrote in message
news:bq******** @enews4.newsguy .com...
Client wants to use Alt+hotkey...

I'am acctuayl not using comboboxes, but autocompletecom bobox (inherited from combo + autocomlete logic).

I intercept keydown in ACCombobox, handle it, and call mybase.keydown. ....
But the form doesn't raise keydown (keypreview)... .

thanks,
habix
"EricJ" <ericRéMo**@Thi Somnipack.be> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


yust a thought
you might want to get other combinations then the alt+..
Everything works fine, except when i have focus on combobox.
Then the event on form isn't raised.


are you intercepting the keys on the cbo keypress event?

eric


Nov 20 '05 #10

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

Similar topics

2
1693
by: Carl Tribble | last post by:
I am using KeyPreview on the form to trap Function-keys. My form includes a datagrid. I am using the Form.KeyDown event to trap the keys and all works fine unless the datagrid is showing one or more rows and the focus is in a column on one of the datagrid's rows. Then, pressing a function key does not seem to execute the Form.KeyDown event. How can I trap and detect which function key a user pressed at the form level from inside of a...
1
4489
by: Ori | last post by:
Hi Guys, Here is my problem, but maybe someone can help me with this. Background: 1. Using C#. 2. I'm having a form which the KeyPreview is on (and must stay like this) and I'm implementing some functions on the Key up event of some controls and the form.
1
3221
by: ray well | last post by:
hi, i need to preview the keys in my app in order to process F1-F10. i set keypreview of my form to true, and it does capture the keystrokes from all over the forms controls which i then process. i found 2 puzzeling exception: if the user is inside the text box of a ComboBox, the keystrokes aren't captured in the form's keypress event. i have to separately capture the
1
6170
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled the Form.KeyPress event does not trigger anymore. A way to 'solve' this is to set the focus to the form, but during testing it happens ofter the keypress event is not getting triggered on keys like
13
6077
by: Himselff | last post by:
Hi guys, Im new to dot net and wondering how i could remake the same way i was in vb6, capture all keypress whitin a form, per exemple i was on the form looking for some keypress privete sub form_keypressed(keyascii as integer) if keyascii = 13 then 'for the enter key call button_click
3
7270
by: Nikolay Evseev | last post by:
Hi, I am trying to trace down the Enter key in my Form.KeyPress event handler. The KeyPreview property is set to false, so I'd assume that all key presses should go through my form's KeyPress event handler, right? Ok. If the focus is set to any other control than a button, then the above event handler fires, but if the focus is on a button, then I've no way to know that the Enter key has been pressed or not, because in that case pressing...
9
5116
by: Rob | last post by:
When a custom control is used within a form, that control does not get events directly. I've run into this a couple times with both mouse and keyboard events. Ex: A custom control inherits from UserControl (or Panel, etc). If that particular control is being edited, it IS possible to assign handlers and get events. However, when the control is used on the main form, assigning a handler to the particular control does nothing--the...
4
10979
by: polocar | last post by:
Hi, I would like to find a way in C# so that, when the user presses the "Esc" key, the form closes; the problem is that I have a lot of controls in the form. At the beginning I have tried with the following form event handler: protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e);
1
3881
by: Ben | last post by:
Hi I would like to complete a task whenever F4 is pressed by the user anywhere on a form. The problem is the Key Down event does not fire for the form if the user is, for example within a text box. Is there any method of doing this other than adding the code to the key down event for all controls? Thanks
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8470
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8590
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.