How to create a Dialog on top, that "take over the application"

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
zmau
Knows some wx things
Knows some wx things
Posts: 47
Joined: Wed Jun 15, 2016 11:41 am

How to create a Dialog on top, that "take over the application"

Post by zmau »

Hello all,


I have a multi-TAB wxWidjets application.
On one of the TABs there is a button called "CreateAndActivateThread".
As the name indicates, when the user presses this button I need to :
  • Start a new thread that does some cyclic work
  • Open a sub-Dialog windows with one button - "StopThread". This sub-dialog Shall "take over the application", so that the user can not press anything but "StopThread"
  • When the user presses "StopThread", then I need to stop the thread, close this sub-Dialog, and allow the user to do everything as usual with the original multi-TAB application.
Any advice on how shall I do it ?
Any existing example ?


Thanks
zmau
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to create a Dialog on top, that "take over the application"

Post by doublemax »

Any modal dialog will behave that way. When the dialog is closed, you just have to tell the thread to terminate. There are many ways to do that, like with a simple flag, or a more fancy wxMessageQueue
https://docs.wxwidgets.org/trunk/classw ... _01_4.html
Use the source, Luke!
zmau
Knows some wx things
Knows some wx things
Posts: 47
Joined: Wed Jun 15, 2016 11:41 am

Re: How to create a Dialog on top, that "take over the application"

Post by zmau »

Thanks
Any modal dialog will behave that way
Where can I see a modal dialog code example ?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to create a Dialog on top, that "take over the application"

Post by doublemax »

You could also use a wxProgressDialog
https://docs.wxwidgets.org/trunk/classw ... ialog.html
Use the source, Luke!
Post Reply