This is very much a beginner question, but I haven’t been able to find an answer or work it out.
If I have an app with a few document windows, each of which shows one of the main areas of the app, how do I change seamlessly between them?
I have tried using menu commands with
Window(0).Close // Close the current window
winWindowB.Show // Open desired window
This code certainly does change between the windows, but each time there is a kind of animation — the first one shrinks in size a little before disappearing and the second one first appears a bit smaller than its proper size and then takes about half a second to expand. This is obviously not the way a professional app should behave. The one should just disappear and the other should just appear, so that if they share some part of the display at exactly the same location that part of the display will appear to remain in place.
I’ve tried looking for a different approach, but haven’t been able to find anything. I presume there is a standard, recognized way of doing this in Xojo. (I’m used to changing layouts like this in Filemaker Pro.)
Any help would be much appreciated!
(I’m working on Windows 11.)
Since it seems your project will be showing only one window at a time, maybe you should think about using containers and a pagepanel control. I created a quick example here. Of course, you can use the segmented button control to switch the pagepanel control panels but you will probably want to use some other event.
Thank you, Tim. That is very helpful. I really appreciate the example which demonstrates the use of the pagepanel control.
Would I be correct to assume then that the idea behind using more than one document window is for windows that are likely to be open at the same time?
Yes, these days it would be a safe assumption. Not so long ago it was common to have MDI windows. Now, one might be hard pressed to find an application still using MDI windows that isn’t a legacy application. Today, in my humble opinion, most users are expecting single page applications, even in a desktop application. Xojo pagepanel controls and containers make this very easy to implement.
However, there are still definite uses for separate windows. Think dialog windows, floating toolbars, floating property windows, etc. The key is to balance user experience with application functionality. You can have the most wonderful application but if the user experience is horrible, they are unlikely to use the application.
Thanks again, Tim. Those are very helpful comments on user expectations and how Xojo is able to meet them easily.