enable keyboard shortcuts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello newsgroup,

How can I enable keyboard shortcuts on CF?
Like if I set the text property of a button to &Activate, A will be
underlined so
when I press alt+a that "pushes" the button.

This works fine on the full framework. On CF the letters are underlined but
pressing the alt key has no effect. How to achieve this?

Thanks,
Sitar.
 
Hi,

I forgot to mention that my device has a keyoard and a touch screen but I
need to be able to do everything with the keyboard as well.
I haven't been able to find any info on this on the net/newsgroups. Is there
anyone here who managed to use application-defined keyboard shortcuts on a
mobile device with CF?

Thanks,
Sitar.
 
Hi,
I think key shortcuts are not supported on CF.

One way is to create custom controls (custom button in your case) witch
implements interface containing information about specified shortcut for that
control.

In second step create your own custom form control witch implements
OpenNETCF.Windows.Forms.IMessageFilter witch allows you to handle windows
messages directly. Call ApplicationEx.AddMessageFilter when form is being
shown and ApplicationEx.RemoveMessageFilter when it's being hiden.

In PreFilterMessage iterate throw all form's controls and test whether
control implemets your interface with information about shortcuts and then
test wheter it matches pressed key when handling WM_KEYDOWN event. When you
find your button, just invoke it's Click event handler.
 
Hi Michal,

Thanks for your answer.

I've done a bit of a research since I posted this news. There is actually a
quite good article in MSDN on this matter:
http://msdn.microsoft.com/msdnmag/issues/04/04/KeyboardSupport/default.aspx

For the time being I simply hooked all my controls to a KeyDown event. There
I test ALT+<key> and whatever I want. It may not be the best approach but it
works with minimum coding requirements.

I'm not really clear how writing lot of code to handle native windows
messages would be a better approach to this problem since even in this case
you'd have to write some switch (key something) { case ... } eventually.

If anyone can explain I'll be interested.

Will this issue be resolved with CF 2.0 ? It seems more smart devices have a
keyboard now so enabling keyboard shortcus like the FF could be useful maybe.

Thanks,
Sitar.
 
Back
Top