开发者

Changing dialog boxes

开发者 https://www.devze.com 2023-03-18 16:36 出处:网络
win32 API: So let\'s say I have a dialog 开发者_如何学Cbox with 2 menu items, \"Menu Item A\" and \"Menu Item B\"

win32 API:

So let's say I have a dialog 开发者_如何学Cbox with 2 menu items, "Menu Item A" and "Menu Item B"

When I click "Menu Item A" I want the main screen of the current dialog to change to dialog A's screen

When I click "Menu Item B" I want the main screen of the current dialog to change to dialog B's screen.

How would I do this? I'm new to the win32 api, thanks in advance!


The usual way to do this is to have two child 'container' dialogs as children of your outer frame window; let's call them dialogA and dialogB. These contain the controls for the two respective dialogs. When you want to switch from one to the other, use ShowWindow() to show one dialog and hide the other. In Win32, hiding a HWND also hides all the child controls with it, so you can easily hide and show groups of controls by grouping them in sub-windows like this.

That's an overview of the general technique. As for the sub-dialogs, you can either create them manually using CreateWindow(), or use CreateDialog() to have windows do the work of creating the child controls from a dialog template for you.

This technique is essentially what property sheets and wizards do. (Property sheets add a tab control instead of menus to control which gets displayed, while wizards have next/prev buttons.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号