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 |
|
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
|
|
|
|
|
Goto Forum:
Current Time: Sat May 04 15:04:04 CEST 2024
Total time taken to generate the page: 0.03022 seconds
|