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 » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » TreeGrid Control - Update 6
TreeGrid Control - Update 6 [message #45512] Thu, 26 November 2015 12:53 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Hope someone will find the attached control useful.
The control seems fairly stable & release-ready...(feedback please)
If you check it out, please let me know what you think, and also any bugs, improvements, etc ...

Update 6:
Improved control: Show/Hide treelines & header
Small changes to Demo (added options to R-click menu)
Bug fixes and improved useability of the simple file manager (Linux-only)

The 'TG6.zip' file contains all three projects.

Usage Example

1. Add the TreeGrid package to your project.
2. Add: #include <TreeGrid/treegrid.h> to your source-file.
3. Example:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#include <TreeGrid/treegrid.h>

struct MyClass : public TopWindow 
{
	typedef MyClass CLASSNAME;
	TreeGrid TG;
	MyClass();
	virtual ~MyClass() {}
};

MyClass::MyClass()
{
	Title("MyClass");
	SetRect(0,0,600,600);
	Sizeable();

	Add(TG.HSizePos().VSizePos());

	TG.AddColumn("Column 1", 200).Sorting();
	TG.AddColumn("Column 2", 200);
	TG.AddColumn("Column 3", 200);

	//indentation is just for readability..
	//AddNode can fail in two cases: a supplied key is already used, and when out-of-memory
	Node N=TG.AddNode(0, "tree-label (column 1-cell)", /*0 => at root of tree */
                             "key (if you want one)", 
                             "column2-cell", 
                             "column3-cell");
                         
		TG.AddNode(N, "tree sub-node label", /*N => parent of new node*/
                              "", /*empty user-key - keys are auto-generated if empty*/
                              "col2-cell", 
                              "col3-cell");

		TG.AddNode(N, "sub label1", 
                              "", 
                              "col2-cell", 
                              "col3-cell"); 

		TG.AddNode(N, "sub label2"); /*no key and you can have blank values*/
			//must give key (even empty string) if you want values
			//empty cells corresponding to the columns will be silently created

	N=TG.AddNode(0, "another tree-label", 
                        "", 
                        "cell2", 
                        "cell3", 
                        "cell4 - you can have extra cells for private data");

		TG.AddNode(N, "tree sub-node label", "", "col2-cell", "col3-cell");

		Node N1=TG.AddNode(N, "tree sub-node label", "", "col2-cell", "col3-cell");

			TG.AddNode(N1, "node n1", "", "value", "value");

		TG.AddNode(N, "A Label", "", "col2-cell", "col3-cell");

	TG.RefreshTreeGrid();
}

GUI_APP_MAIN
{
	MyClass().Run();
}


  • Attachment: TG6.zip
    (Size: 63.49KB, Downloaded 273 times)

[Updated on: Tue, 29 December 2015 08:10]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: с++ low-level
Next Topic: simmxtools v0.1
Goto Forum:
  


Current Time: Sat Apr 27 11:49:34 CEST 2024

Total time taken to generate the page: 0.08096 seconds