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  |
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 327 times)
[Updated on: Tue, 29 December 2015 08:10] Report message to a moderator
|
|
|
|
|
Re: Tree-Grid-Widget [message #45515 is a reply to message #45513] |
Thu, 26 November 2015 14:49   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
Thx for feedback. I did look for the Upp random()-func's - new they were there- but not hard enough I suppose Thx koldo.
I don't have Windows available, purely Linux, so I cannot test for Windows compatability.
I tried to stay with standard functions but some POSIX things may have slipped through.
Edit: Updated demo-and-control attachment in original message
[Updated on: Fri, 27 November 2015 09:39] Report message to a moderator
|
|
|
|
Re: Tree-Grid-Widget [message #45594 is a reply to message #45576] |
Sat, 12 December 2015 15:09   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
thx
I am busy cleaning-up and "upp-ising" the source (getting rid of most of the STL replacing with Upp equivalents),
and also doing some refactoring, optimizing and quite a few bug-fixes ...
Also wrote a simple file-manager (Linux-only) to help test the control (along with the demo).
[Updated on: Tue, 29 December 2015 08:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: TreeGrid Control - Update 6 [message #45758 is a reply to message #45757] |
Sat, 02 January 2016 16:58   |
Novo
Messages: 1430 Registered: December 2006
|
Ultimate Contributor |
|
|
slashupp wrote on Sat, 02 January 2016 05:30
is it possible to temporarily install windows on a stand-alone box without any internet connection?
Try to install Wine on Linux. It is a Windows emulator. It is not using anything native from Windows.
Regards,
Novo
|
|
|
|
Re: TreeGrid Control - Update 6 [message #45802 is a reply to message #45765] |
Thu, 07 January 2016 07:14   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
thx koldo
I've started putting #ifdefs into my sources and your suggestions are really useful
I know Wine exists, have never used it (some research coming my way..)
Some questions:
- I assume I can install Upp for Windows under Wine (else you would not have suggested Wine)
- what do I use for compiler/linker - are they bundled with Wine, Upp, ??
- if my Upp-apps run in Wine can I safely assume they are OK for Windows?
- are there any other Upp-developers using Wine this way that can give me pointers/warn about 'gotcha's'?
If this works it'll be brilliant!
PS: Concerning Windows itself: insecurities, calling home, unasked/automatic
updating, ... and add that you can call the americans many things, but stupid
is not one of them, and I will not believe anybody that says Microsoft
is not in bed with the NSA. I don't have anything to hide, but I feel using
Windows is like inviting a peeping-tom in, or exposing yourself in public 
|
|
|
|
Re: TreeGrid Control - Update 6 [message #45806 is a reply to message #45802] |
Fri, 08 January 2016 04:28   |
Novo
Messages: 1430 Registered: December 2006
|
Ultimate Contributor |
|
|
slashupp wrote on Thu, 07 January 2016 01:14
- I assume I can install Upp for Windows under Wine (else you would not have suggested Wine)
Yes, that is correct.
slashupp wrote on Thu, 07 January 2016 01:14
- what do I use for compiler/linker - are they bundled with Wine, Upp, ??
If this works it'll be brilliant!
You need to install a Microsoft Windows SDK.
SDKs include compilers, headers and libraries.
slashupp wrote on Thu, 07 January 2016 01:14
- if my Upp-apps run in Wine can I safely assume they are OK for Windows?
Yes, Wine is a subset of Windows. If your apps works with Wine it will work in Windows. Wine is just a loader of COFF executables and reimplementation of a million of different Windows DLLs.
slashupp wrote on Thu, 07 January 2016 01:14
- are there any other Upp-developers using Wine this way that can give me pointers/warn about 'gotcha's'?
Wine usually doesn't support latest .NET versions, latest D3Dxx API's, and so on. If an SDK installed uses unsupported .NET version, then you can have problems, but you can always install an older version of SDK.
Regards,
Novo
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Apr 27 23:34:00 CEST 2025
Total time taken to generate the page: 0.04060 seconds
|