How to build 'multi interface' application Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
HansLjy
Earned a small fee
Earned a small fee
Posts: 19
Joined: Fri May 21, 2021 6:44 am

How to build 'multi interface' application

Post by HansLjy »

I'm new to wxWidget and I have read several demos given by the wxWidget package, but none of them is 'multi interface' (I don't know if there is a terminology for this either, sorry).

Say I want to write a simple game using wxWidget, I may need a menu interface, a game interface, a setting interface and so on. My question is how can I build them into a single App? Do I need several wxFrame and Close and Show them from time to time? (However when I close it the application is terminated) Or is there an another way?
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to build 'multi interface' application

Post by doublemax »

However when I close it the application is terminated
That should only happen when the last frame is destroyed. Usually you'd have one main frame, the interface for the settings could be a modal dialog or another frame.
You can prevent a frame from being destroyed when it's closed by catching the wxEVT_CLOSE event. E.g. you could just call Hide() in there.
Use the source, Luke!
HansLjy
Earned a small fee
Earned a small fee
Posts: 19
Joined: Fri May 21, 2021 6:44 am

Re: How to build 'multi interface' application

Post by HansLjy »

doublemax wrote: Fri May 21, 2021 7:49 am
However when I close it the application is terminated
That should only happen when the last frame is destroyed. Usually you'd have one main frame, the interface for the settings could be a modal dialog or another frame.
You can prevent a frame from being destroyed when it's closed by catching the wxEVT_CLOSE event. E.g. you could just call Hide() in there.
Many Thanks!

But still I am wandering if I can change the contents of the window itself rather than let another window pop out ? I could handle the settings by dialog but it seems weird to have a new window when I start a new game.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to build 'multi interface' application

Post by doublemax »

What kind of game are we talking about? Is it completely custom-drawn, or will it have any standard GUI elements?

Another alternative to having multiple windows could be to have each "interface" on a different wxPanels and put them in a wxSimpleBook. Then you can switch between the panels with a single call.
Use the source, Luke!
HansLjy
Earned a small fee
Earned a small fee
Posts: 19
Joined: Fri May 21, 2021 6:44 am

Re: How to build 'multi interface' application

Post by HansLjy »

doublemax wrote: Fri May 21, 2021 10:35 am What kind of game are we talking about? Is it completely custom-drawn, or will it have any standard GUI elements?

Another alternative to having multiple windows could be to have each "interface" on a different wxPanels and put them in a wxSimpleBook. Then you can switch between the panels with a single call.
It is a card game like UNO. (This is actually an OOP project so it's really no big deal)
Post Reply