Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Exit app from menu on control in Tab
Exit app from menu on control in Tab [message #58131] Fri, 25 February 2022 09:44 Go to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
I want to exit the app from a menu-item on an ArrayCtrl::WhenBar-handler in a TabCtrl in the main window.

I am using
bar.Add("Exit", [&]{ Break(); }); --- bug - assertion fails

I also tried
bar.Add("Exit", [=]{ Break(); });
but get same error

What is the right way to do so?

Re: Exit app from menu on control in Tab [message #58169 is a reply to message #58131] Mon, 07 March 2022 10:20 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi

This is how I do

	bar.Add ( t_ ( "Exit" ), [=] { Exit(); })
	.Help ( t_ ( "Exit the application" ) );


And Exit() function.

void mainclass::Exit()
{
	Close();
}


Warm Regards

Deepak
Re: Exit app from menu on control in Tab [message #58170 is a reply to message #58169] Mon, 07 March 2022 11:50 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Thanks for the suggestion.
Unfortunately does not work either, and/but I don't get any error-message either, it just does nothing.
(I tried it before with overriding 'Close()' in the mainclass as well)

I debug-traced the execution-calls, it follows:
TopWindow::Close()
Ctrl::IgnoreMouseUp()
Ctrl::Close() - which it completes to '... popup = false; }'
(and then seems to go on with standard Upp processing, I think)
and then nothing happens, the app still runs.

I tried with & without GuiLock __; and also in Release-mode - still fails to close the app
(the app needs to close in a controlled way because a class needs to update a db on dtor)

[Updated on: Mon, 07 March 2022 11:53]

Report message to a moderator

Re: Exit app from menu on control in Tab [message #58171 is a reply to message #58170] Mon, 07 March 2022 11:54 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Slashupp,

Check GeoFun from example folder of UPP.

It may be available other places also.


Warm Regards

Deepak
Re: Exit app from menu on control in Tab [message #58172 is a reply to message #58171] Mon, 07 March 2022 12:05 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
I checked GeoFun just now...
(It works in my app if put an arrayctrl directly in the mainclass) BUT ...
The big/main difference is that I've got a TabCtrl(several tabs) and in a tab there
is a ArrayCtrl as child. It is from the popup-menu on this child arrayctrl that I want to
be able to close the app. I use a pointer to the main-class instance where the Exit()(or /Close())
method is defined to make the call from the lambda. This is what fails.

[Updated on: Mon, 07 March 2022 12:06]

Report message to a moderator

Re: Exit app from menu on control in Tab [message #58176 is a reply to message #58172] Mon, 07 March 2022 17:09 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello slashupp

Have you tried posting a callback to the main window/loop. (e.g. using PostCallback([&] { Break();} ) method) ?

Best regards,
Oblivion


Re: Exit app from menu on control in Tab [message #58177 is a reply to message #58176] Mon, 07 March 2022 18:17 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Hi Oblivion

Doing 'PostCallback([&] { Break(); })' does not work.
but when I replace the call to Break(); with a call to the Exit(); from deep's answer it works!
'PostCallback([&] { Exit(); })' - works! Smile

Thank you
Previous Topic: i got it guys msvc does compile U++ gui
Next Topic: How to compile with MSVC... is it possible?
Goto Forum:
  


Current Time: Fri Mar 29 01:07:28 CET 2024

Total time taken to generate the page: 0.01347 seconds