带有嵌套对话框的选项卡控件中的选项卡顺序 (WS_EX_CONTROLPARENT) [英] Tab order in tab control with nested dialogs (WS_EX_CONTROLPARENT)

查看:37
本文介绍了带有嵌套对话框的选项卡控件中的选项卡顺序 (WS_EX_CONTROLPARENT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Win32 API C++ 项目中,我有一个带有选项卡控件(3 个选项卡)和 3 个作为选项卡控件子项的对话框的对话框.我使用 DialogBoxParam 加载带有选项卡控件的主对话框,并使用 CreateDialogParam 从资源中加载子对话框.主对话框与子对话框一起出现.单击选项卡显示/隐藏正确的子对话框,一切正常.

In a Win32 API C++ project, I have a dialog with a tab control (3 tabs) and 3 dialogs that are children of the tab control. I load the main dialog with tab control using DialogBoxParam, and the child dialogs from resources with CreateDialogParam. The main dialog appears with the child dialogs. Clicking the tabs shows/hides the correct child dialog, everything working fine.

在搜索选项卡顺序后,我发现在选项卡控件上设置了 WS_EX_CONTROLPARENT 样式,以便在子对话框窗口中使用选项卡.这很好用,除了一个问题:选项卡控件本身永远不会获得焦点,所以我无法使用键盘切换到选项卡控件以更改为不同的选项卡.键盘焦点通过子对话框,到主对话框上的按钮,然后直接回到子对话框,并且永远不会停留在选项卡控件本身上,所以我必须单击选项卡控件来更改选项卡.这让我疯狂.有什么建议吗?

After searching around about tab orders I found the WS_EX_CONTROLPARENT style to set on the tab control to get tabbing working into the child dialog windows. This works great, except for one problem: The tab control itself never gets focus, so I can't tab to the tab control to change to a different tab with the keyboard. Keyboard focus goes through the child dialog, to the buttons on the main dialog, then directly back to the child dialog, and never stops on the tab control itself, so I have to click on the tab control to change tabs. It's driving me crazy. Any suggestions?

更新:我设法通过完全忘记 WS_EX_CONTROLPARENT 并让子对话框成为选项卡控件的兄弟来解决这个问题.唯一的副作用似乎是在重绘期间控件闪烁更多,但仍然希望得到答案,因为使选项卡的子对话框看起来更干净.

Update: I managed to work around the problem by forgetting about WS_EX_CONTROLPARENT completely, and making the child dialogs siblings of the tab control. Only side effect seems to be more flashing of controls during a repaint, but would still like an answer, since making the child dialogs children of the tab seems cleaner.

推荐答案

它并不干净.创建选项卡式对话框的推荐方法是将选项卡页设为对话框的子项.选项卡控件只是控制哪些页面是可见的,但不是它们的父页面.

Its not cleaner. The recommended way to create tabbed dialogs is to make the tab pages children of the dialog. The tab control simply controls which of the pages is visible, but is not their parent.

当您尝试在对话框中使用 XP 主题时,这一点尤其重要.

This is especially important when you might try to get XP themeing working on the dialog.

WS_EX_CONTROLPARENT 是一种旨在在实际选项卡"对话框上设置的样式.

WS_EX_CONTROLPARENT is a style intended to be set on the actual 'tab' dialogs.

我想您已经在选项卡控件本身上设置了 WS_TABSTOP?我想到 ws_tabstop ws_ex_controlparent 冲突时同时设置,因为它们告诉对话框管理者在选项卡循环到达控件时执行两个完全不同和冲突的事情.

I presume you have set WS_TABSTOP on the tab control itself? I imagine that WS_TABSTOP and WS_EX_CONTROLPARENT conflict when simultaneously set as they tell the dialog manager to do two entirely different and conflicting - things when the tab cycle reaches the control.

最后,我完全看不出闪烁应该增加的任何原因,因为对话框页面是对话框的子级而不是选项卡控件.

Lastly, I cannot see any reason at all that flickering should increase because the dialog pages are children of the dialog rather than the tab control.

这篇关于带有嵌套对话框的选项卡控件中的选项卡顺序 (WS_EX_CONTROLPARENT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆