Form KeyPreview

  • Thread starter Thread starter HABJAN ®iga
  • Start date Start date
H

HABJAN ®iga

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
 
* "HABJAN ®iga said:
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)?
 
Why not define hidden menu items with the "hotkeys" ('Shortcut'
property)?

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
 
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
 
Client wants to use Alt+hotkey...

I'am acctuayl not using comboboxes, but autocompletecombobox (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
 
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
 
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
 
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

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 (e-mail address removed)
 
* "HABJAN Ziga said:
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).
 
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
 
have you tried using (in the text of the menu item) nam&e --> alt+e would
be the shortcut (the menu item would have to be top level i think)


HABJAN Ziga said:
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
 
exactly :) the key preview is set to true. but when i have focus on combobox
the keydown event on form isn't raised.

re,
habix
 
I think that microsoft has to make some bugfixes in form's controls
(framework).

I had trouble with comboboxes (keypreview), date-time pickers (frezzes main
thread - to solve this one i needed to use vb6's dt-pickers - but they don't
have itemchecked event...), listview's (triple select index changed events
if changing property selectedindex within event - but only in runtime,
everything works fine in debug mode)....

I had troublues with combos even in html page =), they are allways topmost
component
- no ****in <div
style="position:absolute;x:0,y:0:height:100%;width=100%;bgcolor=black" />
can't be over it

I am seriously thinking about buying some stable components or start
learning delphi or something....

re,
habix
 
You are absolutely correct. This appears to be a bug, you should report it
to Microsoft.

Regards - OHM


exactly :) the key preview is set to true. but when i have focus on
combobox the keydown event on form isn't raised.

re,
habix

Best Regards - OHMBest Regards - OHM (e-mail address removed)
 
Back
Top