Bob5
July 29th, 2005, 11:28 AM
Hello, I'm quite new to win32 programming. What I want to do in my application (dialog based) is that I want it to have something like a tab control, without the tabs. Like a window showing specific things, and on an event, it changes the window to another window.
I have no idea how to achieve this, I've searched around without luck.
Bob5
kirants
July 29th, 2005, 04:36 PM
You can do it in multiple ways:
Option 1:
1. Destroy old window
2. Create new window in it's place
Option 2:
1. Hide old window
2. Disable old window
3. Show new window
4. Enable new window
Bond
July 31st, 2005, 09:27 AM
"Wizards" do this very thing. You've probably seen them used for installing programs, setting parts of the software up (Internet Connection Wizard is a popular one), etc.
As Kirants said, you can take a few approaches. If the number of windows (or "pages") to load is relatively small (and consistent), I'll usually load them all during program startup, then show just the first one. When the user clicks a button to advance to the next page, just hide/disable the current window and show/enable the next. Since the window has already been created (just hidden), this is a very fast process. Also, since ALL of the windows exist during the lifetime of your program, you can communicate with them easily (retrieving selected options, enabling/disabling controls based on a selected option, etc.).
If you're going to have a large or dynamic set of pages, however, it's probably best to create each window as it's needed and destroy it when it's no longer needed. If you do this in a consistent way (same size, same position), it'll look like it's simply loading new controls onto the same window (instead of loading a new window alltogether). One small trick: create (or show) the new window before destroying (or hidng) the old. This will prevent any "flashing" of the desktop or whatever window appears below yours in the Z-order. So, take Kirants advice, but start from the bottom up.