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 » U++ Widgets - General questions or Mixed problems » 603.r9 TreeCtrl etc. repaint optimization [BUG?]-No,feature.ParentCtrl and Ctrl
603.r9 TreeCtrl etc. repaint optimization [BUG?]-No,feature.ParentCtrl and Ctrl [message #1852] Thu, 23 March 2006 09:29 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
try this code:
#include <CtrlLib/CtrlLib.h>

class DirView : public Ctrl {
	Splitter   horz;
	TreeCtrl   tree1;
	ArrayCtrl table;

	Label      label;
	StatusBar  info;
	Array<EditString> edit;
	EditField wnd_edit, path_fld;

public:
	typedef DirView CLASSNAME;

	void OpenDir(int id);
	void CloseDir(int id); 
	void ShowPath();
	DirView();
	~DirView() {;}
};


    
void DirView::CloseDir(int id) {
		tree1.RemoveChildren(id);
	}



void DirView::OpenDir(int id) {
		String path = tree1.Get(id);
		for(FindFile ff(AppendFileName(path, "*.*")); ff; ff.Next()) {
			String n = ff.GetName();
			if(n != "." && n != "..")
				tree1.Add(id, ff.IsFolder() ? CtrlImg::Dir() : CtrlImg::File(),
				          AppendFileName(path, n), n, ff.IsFolder());
			
		}
			table.Add(id,path);
	}

void DirView::ShowPath() {
		info = ~tree1;
	}


DirView::DirView() {
		path_fld.SetRect(0,0,350,50);
		Add( path_fld.TopPos(10) );
		
		horz.Add(tree1);
		horz.Add(table);
		horz.Add(wnd_edit);
		
		Add(horz.Horz().VSizePos(50,50));
	#ifdef PLATFORM_WIN32
		String dir = String(GetExeFilePath()[0], 1) + ":\\";
	#else
		String dir = "/usr";
	#endif
		tree1.SetRoot(CtrlImg::Dir(), dir);
		
		tree1.MultiSelect();

		tree1.WhenOpen = THISBACK(OpenDir);
		tree1.WhenClose = THISBACK(CloseDir);   

		tree1.WhenCursor = THISBACK(ShowPath);

		tree1.AddFrame(info);
		tree1.Open(0,true);

		table.AddColumnAt(0,"id",10);
		table.AddColumnAt(1,"path",50);
		

}


GUI_APP_MAIN
{	TopWindow w;
    DirView dirview;
    dirview.SizePos();
    w.Add(dirview);
	w.Zoomable().Sizeable().Run();
}

[Updated on: Mon, 01 May 2006 20:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: What Label.WhenAction supposed to do? - nothing [PARTLY SOLVED :)]
Next Topic: how to bind or convert Logc positions to int?
Goto Forum:
  


Current Time: Tue Jun 03 05:30:06 CEST 2025

Total time taken to generate the page: 0.02363 seconds