开发者

Changing dialog boxes

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜