3

We have a relatively large MFC application that uses an SDI to host a number of dynamically created CView- based views. The basic structure of the application is somewhat like Outlook (tree view on the left, dynamic view(s) on the right).

I've been puzzling over the correct way to handle focus changing in the app. For example, I'd like to be able to hit 'tab' whilst the focus is in the tree view (left view), and move the focus to the right view. Whilst I could capture the tab key in the tree ctrl and manually change to the appropriate view, we have a lot of different view types (some CFormView- based), and a lot of splitter controls and I'm unsure whether there a more generic way to handle it.

I know setting the focus in a CDialog- or CFormView- is easy (just using the built-in tab order manager in Visual Studio), but an application which hosts multiple view types and splitter bars etc. is far more complex. For example, if the focus is currently in a form-view, when I tab over the end of the form view tab order, how do I detect that I need to change the input focus to another (dynamic) view?

Cheers and thanks all.

Darren.

Darren Ford
  • 856
  • 5
  • 10

1 Answers1

0

One obvious answer would be to simplify the UI itself.

Another is to just 'tab' inside a view and require the user to use mouse to switch from one view to another; alternatively, you can create a view menu item and let the user choose the view by making a menu selection (keyboard could be used, e.g., to choose view 1 by pressing Alt-V-1).

The final option would be what you have mentioned yourself: detect Tab key and handle everything yourself.

Jaywalker
  • 3,079
  • 3
  • 28
  • 44