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 » Community » Newbie corner » OptionTree inside a DropTree
OptionTree inside a DropTree [message #53421] Thu, 02 April 2020 11:41 Go to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
I need to allow multiple selections between around 10 options that why I was thinking about an OptionTree with one node inside a DropTree (to reduce space). Is it something possible?

Best,
Matteo
Re: OptionTree inside a DropTree [message #53523 is a reply to message #53421] Wed, 08 April 2020 13:02 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
No news is bad news?

Matteo Sad
Re: OptionTree inside a DropTree [message #53536 is a reply to message #53523] Thu, 09 April 2020 10:00 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
you can start by this :
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	PopUpTable list;
	list.AddColumn("");
	list.SetDropLines(9);
	
	
	for(int i = 0; i < 7; i++){
		list.Add();
		list.CreateCtrl<Option>(i, 0, false).SetLabel("Option " + AsString(i));
	}
	
	Button x;
	x.WhenAction = [&]{list.PopUp(&x);};
	

	TopWindow w;
	w.Add(x.LeftPos(20, 200).TopPos(50, 24));
	w.Run();
}



regards
omari.
Re: OptionTree inside a DropTree [message #53560 is a reply to message #53536] Sun, 12 April 2020 11:47 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member


thank-you Omari!

It seems interesting but how can i retrieve info about Options I set in each line?

I can't find so much documentation/examples about PupupTable...

Best,
Matteo
Re: OptionTree inside a DropTree [message #53563 is a reply to message #53560] Sun, 12 April 2020 14:46 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
GUI_APP_MAIN
{
	PopUpTable list;
	list.AddColumn("");
	list.SetDropLines(9);
	
	
	for(int i = 0; i < 7; i++){
		list.Add();
		list.CreateCtrl<Option>(i, 0, false).SetLabel("Option " + AsString(i));
	}
	
	Button x;
	x.WhenAction = [&]{list.PopUp(&x);};
	
	Button y;
	y.WhenAction = [&]{
		
		String r;
		for(int i = 0; i < list.GetCount(); i++)
		{
			Option* o = (Option*)list.GetCtrl(i, 0);
			if(o && *o)
				r << (o->GetLabel()) << "&";
		}
		
		PromptOK(r);
	};

	

	TopWindow w;
	w.Add(x.LeftPos(20, 200).TopPos(50, 24));
	w.Add(y.LeftPos(20, 200).TopPos(150, 24));
	w.Run();
}


regards
omari.
Re: OptionTree inside a DropTree [message #53627 is a reply to message #53563] Thu, 16 April 2020 14:30 Go to previous message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
Thank you Omari,
It works very well.

Is it my fault but I do not understand at all the meaning of

=  [&] {


when you set a WhenAction.

Thanks,
Matteo
Previous Topic: Read txt, analyze and convert to csv
Next Topic: SelectFileOpen and VPN
Goto Forum:
  


Current Time: Fri Mar 29 16:33:42 CET 2024

Total time taken to generate the page: 0.01871 seconds