| Function CreateTreeView:TGadget(x,y,w,h,group:TGadget,style=0) |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End |
![]() |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Local Folder:int=ReadDir(BlitzMaxPath()) Local File:String Repeat File=NextFile(Folder) AddTreeViewNode(file,MyTreeView) Until File=Null Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End |
![]() |
| Local Folder:int=ReadDir(BlitzMaxPath()) |
| Repeat File=NextFile(Folder) AddTreeViewNode(file,MyTreeView) Until File=Null |
| Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else AddTreeViewNode(file,MyTreeView) EndIf Until File=Null |
![]() |
| Function AddTreeViewNode:TGadget( text$,node:TGadget,icon=-1 ) |
![]() |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Local Folder:int=ReadDir(BlitzMaxPath()) Local File:String Local IconStrip:TIconStrip=LoadIconStrip("D:\My Documents on E\_Tutorials\toolbar.bmp") SetGadgetIconStrip(MyTreeView, IconStrip) Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else AddTreeViewNode(file,MyTreeView) EndIf Until File=Null Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End |
![]() |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Local Folder:int=ReadDir(BlitzMaxPath()) Local File:String Local FullPath:String Local IconStrip:TIconStrip=LoadIconStrip("D:\My Documents on E\_Tutorials\toolbar.bmp") SetGadgetIconStrip(MyTreeView, IconStrip) Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else fullPath = RealPath(BlitzMaxPath()+"/"+file) If FileType(FullPath)=FILETYPE_DIR Then AddTreeViewNode(file,MyTreeView,1) Else AddTreeViewNode(file,MyTreeView,0) EndIf EndIf Until File=Null Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End |
![]() |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Local IconStrip:TIconStrip=LoadIconStrip("D:\My Documents on E\_Tutorials\toolbar.bmp") SetGadgetIconStrip(MyTreeView, IconStrip) EnumFiles(BlitzMaxPath(),MyTreeView) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End Function EnumFiles:Int(Dir:String, Parent:TGadget) Local Folder:int=ReadDir(Dir) Local File:String Local FullPath:String Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else fullPath = RealPath(BlitzMaxPath()+"/"+file) If FileType(FullPath)=FILETYPE_DIR Then AddTreeViewNode(file,MyTreeView,1) Else AddTreeViewNode(file,MyTreeView,0) EndIf EndIf Until File=Null End Function |
![]() |
| SuperStrict Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,330,MyWindow) Local IconStrip:TIconStrip=LoadIconStrip("D:\My Documents on E\_Tutorials\toolbar.bmp") SetGadgetIconStrip(MyTreeView, IconStrip) EnumFiles(BlitzMaxPath(),MyTreeView) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_GADGETACTION Local Node:TGadget = SelectedTreeViewNode(MyTreeView) Local s:String=String(Node.Context) If s>"" EnumFiles(s,node) node.context="" EndIf ExpandTreeViewNode(node) End Select Forever End Function EnumFiles:Int(Dir:String, Parent:TGadget) Local Folder:int=ReadDir(Dir) Local File:String Local FullPath:String Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else fullPath = RealPath(Dir+"/"+file) If FileType(FullPath)=FILETYPE_DIR Then Local handle:TGadget=AddTreeViewNode(file,Parent,1) handle.context=FullPath Else AddTreeViewNode(file,Parent,0) EndIf EndIf Until File=Null End Function |
![]() |
| Function EnumFiles:Int(Dir:String, Parent:TGadget) Local Folder:int=ReadDir(Dir) Local File:String Local FullPath:String Repeat File=NextFile(Folder) If File=".." Or File="." Or File=Null Then 'Do Nothing Else fullPath = RealPath(Dir+"/"+file) If FileType(FullPath)=FILETYPE_DIR Then Local handle:TGadget=AddTreeViewNode(file,Parent,1) handle.context=FullPath Else AddTreeViewNode(file,Parent,0) EndIf EndIf Until File=Null End Function |
| Case EVENT_GADGETACTION Local Node:TGadget = SelectedTreeViewNode(MyTreeView) Local s:String=String(Node.Context) If s>"" EnumFiles(s,node) node.context="" EndIf ExpandTreeViewNode(node) |