views:

43

answers:

1

I am having Dialog Box Application written in MFC. Dialog is having 3 child controls on it. 2 Buttons (Button 1 & Button 2) and a HTML Control (Class derived from CHtmlView) HTML Control has been navigated to a HTML page having 2 checkboxes (Check Box 1 & Check Box 2).

Control Z-Order for focus should be like: Button 1 Button 2 HTML Control then again Button 1

When focus goes to HTML Control. I want it to set to Check Box 1 & then after pressing tab it will be set to Check Box 2. But When I press tab while the focus in on Check Box 2, I want it to set to Button 1.

i.e. I want focus cycle like : Button 1 -> Button 2 -> Check Box 1 in HTML Control -> Check Box 2 in HTML Control -> then again Button 1

Problem: When the focus is set to HTML Control, it doesn't get set to Check Box 1 and after pressing tab while focus is on Check Box 2 focus doesn't come back to Button 1.

Let me know if question is not descriptive enough, I will simplify it more. Appreciate your time.

Thanks, Vaibhav D. Gade

A: 

I can't test it but you may try to add the WS_EX_CONTROLPARENT style to the HTML control.

int OnInitDialog(...)
{
   HWND html = GetDlgItem(dialog, ID_HTML);
   DWORD ex_style = GetWindowLong(html, GWL_EXSTYLE);
   SetWindowLong(html, GWL_EXSTYLE, ex_tyle | WS_EX_CONTROLPARENT);
   return 0;
}

I hope it works.

Tassos
Thanks for your response.But Still the Problem persists.How can I set focus to Check Box 1 of HTML Control after pressing tab on Button 2 of parent dialog.Also How can I return focus back to Button 1?I want focus to cycle as Button 1 -> Button 2 -> Check Box 1 -> Check Box 2 -> Again Button 1.Thanks,Vaibhav.
Vaibhav Gade
Does the HTML control have the WS_TABSTOP style?
Tassos
I have a dialog box with an html control that behaves as expected (at least for the links). The line in the resource file is:CONTROL "",IDC_EXPLORER,"{8856F961-340A-11D0-A96B-00C04FD705A2}",WS_TABSTOP,7,210,333,39
Tassos
Vaibhav Gade