That's probably because the menu shortcut gets acted upon using the
dialog command notification messages. My guess is that those messages
get sent to the combo box drop down window while the window is visible
and that window has no idea what to do with them.

There are a number of things you can do to solve this:

You can register a global HotKey using RegisterHotKey or the
TJvApplicationHotKey wrapper in the Jedi VCL. Using this will get the
job done (I've tested it with a drop down box on a form) BUT be aware
the hot key is truly global: You can minimize your application or switch
to a different application, type your keyboard shortcut and the code
will run just fine!

If the global hot key functionality seems excessive for your
application, you may try other solutions, but the
TJvApplicationHotKey/RegisterHotKey solution is VERY simple compared to
any of the alternatives:

Alternative #1: Register a keyboard hook using SetWindowsHookEx - you'll
see all keyboard events going to your application (or any other
application, depending on how you set things up).

Alternative #2: Run your own message pump. Take a look at how ShowModal
work (copy/paste the code). This will also work, unless the combo box
also runs its own pump while the drop down window is down :-)

And I'm sure there are other ideas...

--
Cosmin Prund

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Chuck Belanger
> Sent: 14 noiembrie 2007 22:06
> To: Delphi Listserve
> Subject: How to have menu short-cuts acted on when TComboBox is open?
> 
> Hello:
> 
> Need help to work around this issue:
> 
> Using a foot pedal to fire events associated with a number of
controls.
> Once such control is a TComboBox. The Left pedal keys in ALT+J which
> fires a popupmenu item with that shortcut. The popup event does the
> work
> to fire the event for the TComboBox or the other controls.
> 
> This works great for using a foot pedal through out my application,
> except when the ComboBox's drop down list is open. After a lot of
> experimenting, the ALT+J is just not acted on at all. My intent is to
> open the drop down list with the Left pedal and on the second press of
> the Left pedal close it up. It opens fine, but no keyboard message
goes
> through with the drop down list open, thus it cannot close without a
> manual click.
> 
> I've tried using a TMenu item with shortcut and this acts the same
way,
> i.e. no access to the short-cut when the ComboBox drop down list is
> open.
> 
> I've tried using other short-cuts, still no success.
> 
> It literally stops all forward movement through my app on this one
> issue. Any work arounds?
> 
> So far the only thing that kind of works, is to add a TTimer and have
> it
> fire a ComboBox.DroppedDown := false after a short period of time,
long
> enough for the user to see the possible selection. (The RIGHT pedal
> allows incremental selection of the combo box.) The whole idea of
using
> the foot pedal is for people (Health practitioners) who are in a
> position where they cannot access a mouse while working with a
patient.
> 
> Thank you for your help,
> 
> Chuck Belanger
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to