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++ Library support » U++ Library : Other (not classified elsewhere) » BUG dialog does not close
BUG dialog does not close [message #50543] Wed, 14 November 2018 09:41 Go to next message
slashupp is currently offline  slashupp
Messages: 145
Registered: July 2009
Experienced Member
debian, upp v 12181

clicking the 'x' in title-bar to close test_dialog in following app does not:
the dialog goes away but when main_window is clicked it reappears and hangs.

#include <CtrlLib/CtrlLib.h>
using namespace Upp;

struct DTest : public TopWindow
{
	typedef DTest CLASSNAME;
	DTest() { Title("test-dialog"); }
	virtual ~DTest() {}
};


struct test_bug_dlg : public TopWindow
{
	typedef test_bug_dlg CLASSNAME;
	Button btnTest;
	test_bug_dlg()
	{
		Title("main-window");
		btnTest.SetLabel("Test Dlg");
		btnTest.WhenPush=THISBACK(OnTest);
		Add(btnTest.LeftPos(10,70).TopPos(10,20));
	}
	void OnTest() { DTest dlg; dlg.Execute(); }
};

GUI_APP_MAIN
{
	test_bug_dlg().Run();
}


Re: BUG dialog does not close [message #50544 is a reply to message #50543] Wed, 14 November 2018 10:00 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 524
Registered: August 2007
Location: Turkey
Contributor
Hello slashupp,

That's because WhenPush is also called whenever a pusher has focus AND the left mouse is down. (See Pusher::LeftDown());.
Hence the freeze.
Still, this might be a bug though.

It has its uses, but given your test-case, you don't seem to need it. What you need to use is WhenAction()

btnTest.WhenAction = THISFN(OnTest);




Best regards,
Oblivion

[Updated on: Wed, 14 November 2018 10:07]

Report message to a moderator

Re: BUG dialog does not close [message #50545 is a reply to message #50544] Wed, 14 November 2018 10:24 Go to previous message
slashupp is currently offline  slashupp
Messages: 145
Registered: July 2009
Experienced Member

yes, thx WhenAction is what I need

a thought:
the behaviour on WhenPush is understandable, but it would seem
the LostFocus &/ LeftUp events are lost somewhere...
and the second appearance of the dialog cannot be closed (hangs)

I know I can subclass and create my own, however it would be handy
if there is a similar default event-handler for WhenClick[ed] that
does not have the gotcha of WhenPush
Previous Topic: [BUG] Removed properties of CommonFontInfo struct are referenced in XFtGetFontInfoSys()
Goto Forum:
  


Current Time: Thu Dec 13 04:36:29 CET 2018

Total time taken to generate the page: 0.01017 seconds