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 » TabCtrl » TabCtrl.WhenSet is called when app closes
TabCtrl.WhenSet is called when app closes [message #60483] Tue, 05 March 2024 07:40 Go to previous message
pvictor is currently offline  pvictor
Messages: 67
Registered: December 2015
Member
Hi!

Here's a testcase:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct Tab0: ParentCtrl {
	Button bt;
	Tab0() { Add(bt.SetLabel("Bt 0").LeftPos(10,100).TopPosZ(10,20)); }
};

struct Tab1: ParentCtrl {
	Button bt;
	Tab1() { Add(bt.SetLabel("Bt 1").LeftPos(10,100).TopPosZ(10,20)); }
};

struct Tab2: ParentCtrl {
	Button bt;
	Tab2() { Add(bt.SetLabel("Bt 2").LeftPos(10,100).TopPosZ(10,20)); }
};

struct Test: TopWindow {
	TabCtrl Tabs;
	Tab0 tab0;
	Tab1 tab1;
	Tab2 tab2;
	Test() {
		SetRect(0, 0, 640, 480);
		Add(Tabs.SizePos());
		Tabs.Add(tab0.SizePos(), "Tab 0");
		Tabs.Add(tab1.SizePos(), "Tab 1");
		Tabs.Add(tab2.SizePos(), "Tab 2");
		Tabs.WhenSet = [this] {
			switch (Tabs.Get()) {
				case 0: ErrorOK("Tab 0"); break;
				case 1: ErrorOK("Tab 1"); break;
				case 2: ErrorOK("Tab 2");
			}
		};
//		WhenClose = [this] { Tabs.WhenSet=Null; Close(); };	// this helps to prevent unwanted events
	}
};

GUI_APP_MAIN {
	Test().Run();
}

When closing the window, I at first get three WhenSet events (one for each tab).
This happens both on Windows and Linux.

Best regards,
Victor
 
Read Message
Read Message
Read Message
Previous Topic: tabctrl contents not visible
Goto Forum:
  


Current Time: Mon May 13 22:18:13 CEST 2024

Total time taken to generate the page: 0.01922 seconds