views:

524

answers:

2

I have a windows mobile 5.0 app, written in C++ MFC, with lots of dialogs. One of the devices I'm currently targetting does not have a tab key, so I would like to use another key to move between controls. This is fine for buttons but not edit controls or combo boxes. I have looked at a similar question but the answer does not really suit. I've tried overriding the CDialog::OnKeyDown to no avail, and would rather not have to override the keystroke functionality for every control in every dialog. My thoughts so far are to write new classes replacing CEdit and CComboBox, but as always am just checking if there is an easier way, such as temporarily re-programming another key.

+1  A: 

I don't know MFC that good, but maybe you could pull it off by subclassing window procedures of all those controls with a single class, which would only handle cases of pressing cursor keys and pass the rest of events to the original procedures.

You would have to provide your own mechanism of moving to an appropriate control, depending on which cursor key was pressed but it may be worth the usability gains.

If that worked, you could enumerate all dialog controls and subclass them automatically.

Windows Mobile 6 allows switching between dialog controls using cursors by default - it's a new, more "smartphoney" way of moving around the UI and it's incredibly convenient.

macbirdie
Got the subclassing working ok, many thanks for that. I haven't figured out how to automatically subclass all similar controls, but that'll be another question.
Shane MacLaughlin
A: 

Can you not use the D-Pad to navigate between fields?

Matt Lacey