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 » U++ community news and announcements » TreeCtrl now supports edit on click - WhenEdited
TreeCtrl now supports edit on click - WhenEdited [message #55308] Wed, 28 October 2020 15:27
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This is similar to e.g. how renaming files in FileSel (or even your OS file manager) works - you click on already selected item and editor pops up.

Demo in reference/TreeCtrlEdited:

#include "CtrlLib/CtrlLib.h"

using namespace Upp;

struct App : TopWindow {
	Splitter split;
	TreeCtrl tree1, tree2;
	EditInt  int_editor;

	typedef App CLASSNAME;
	
	App() {
		tree1.WhenEdited << [=](const Value& v) { // using default EditString
			if(tree1.IsCursor())
				tree1.Set(tree1.GetCursor(), v);
		};

		tree2.Editor(int_editor);
		tree2.WhenEdited << [=](const Value& v) {
			if(tree2.IsCursor())
				tree2.Set(tree2.GetCursor(), v);
		};

		split << tree1 << tree2;
		Add(split.SizePos());

		for(int i = 0; i < 100; i++) {
			tree1.Add(i ? Random(i) : 0, Null, AsString(Random()));
			tree2.Add(i ? Random(i) : 0, Null, (int)Random());
		}
		
		tree1.OpenDeep(0);
		tree2.OpenDeep(0);
	}
};

GUI_APP_MAIN
{
	App().Run();
}
Previous Topic: Sort (and CoSort) refactored
Next Topic: String.Compare optimised
Goto Forum:
  


Current Time: Tue Apr 16 18:17:01 CEST 2024

Total time taken to generate the page: 0.01486 seconds