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.
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.
精彩评论