views:

120

answers:

1

I have an SDI application written in MFC. The frame is divided into 1 row and 2 columns using a splitter window. Below are details of Row and Column (R0C0 means Row#0 and Col#0)

  1. R0C0 view is a CFormView with multiple input controls like text box, combo box etc.
  2. R0C1 view is a CHtmlView that contains HTML content relavant to the control that has input focus in the R0C0

I am able to update the HTML content and also invoke Javascript functions through my MFC code.

Problem: When user clicks on the R0C1, continaing CHtmlView, the focus is now on the html page. I wish to allow the user to tab out of R0C1 using the key board and return back to R0C0. Can you help with this please? The user can obviously click on the R0C0 view using mouse but we have a user who needs to use Keyboard for using this functionality.

Let me know if the question is not descriptive enough and I'll simplify it further.

Appreciate your time.

Thanks, Byte

+1  A: 

Try to overload CHtmlView::OnTranslateAccelerator. I have successfully used this trick to disable refresh with F5 key. Derive your own class from CHtmlView and overload

virtual HRESULT OnTranslateAccelerator(LPMSG lpMsg, const GUID* pguidCmdGroup, DWORD nCmdID);

like this:

HRESULT CMyHtmlView::OnTranslateAccelerator(LPMSG lpMsg, const GUID* pguidCmdGroup, DWORD nCmdID)
{
    if(lpMsg->message == WM_KEYDOWN && GetAsyncKeyState(VK_TAB) != 0 )
    {
        // change focus
        return S_OK;
    } 
    return CHtmlView::OnTranslateAccelerator( lpMsg, pguidCmdGroup, nCmdID);
}
FenchKiss Dev
FenchKiss Dev,Thank you for your answer. I'll see how I can use your method in my application context.I am currently using a different method. I am have attached my CHtmlView derived class as an event sink for HTMLDocumentEvents2. This way I receive click, focus etc event for each element in the document. When the focus reaches a particular element in the page I'll set focus to the other view.Thanks
byte