Code: Select all
;
#TV_FIRST = $1100
#TVM_SETBKCOLOR = #TV_FIRST + 29
#TVM_SETTEXTCOLOR = #TV_FIRST + 30
#WindowIndex = 0
#GadgetIndex = 0
#ImageIndex = 0
#StatusBarIndex = 0
#MenuBarIndex = 0
#Window_Form1 = #WindowIndex : #WindowIndex = #WindowIndex + 1
#MenuBar_Form1 = #MenuBarIndex : #MenuBarIndex = #MenuBarIndex + 1
#MenuBar_Form1_exit = #GadgetIndex : #GadgetIndex = #GadgetIndex + 1
#MenuBar_Form1_run = #GadgetIndex : #GadgetIndex = #GadgetIndex + 1
#Gadget_Form1_icat = #GadgetIndex : #GadgetIndex = #GadgetIndex + 1
#Gadget_Form1_dirtree = #GadgetIndex : #GadgetIndex = #GadgetIndex + 1
#Gadget_Form1_filebox = #GadgetIndex : #GadgetIndex = #GadgetIndex + 1
#StatusBar_Form1 = #StatusBarIndex : #StatusBarIndex = #StatusBarIndex + 1
#StatusBar_Form1_Field1 = 0
#StatusBar_Form1_Field2 = 1
#StatusBar_Form1_Field3 = 2
;
NewList dir.s()
;
Procedure.l Window_Form1()
If OpenWindow(#Window_Form1,213,47,640,580,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Work Form1")
CreateMenu(#MenuBar_Form1,WindowID(#Window_Form1))
MenuTitle("Files")
MenuBar()
MenuItem(#MenuBar_Form1_exit,"Exit")
MenuTitle("Jobs")
MenuBar()
MenuItem(#MenuBar_Form1_run,"Run Job")
If CreateGadgetList(WindowID())
Frame3DGadget(#Gadget_Form1_icat,0,0,640,540,"")
TreeGadget(#Gadget_Form1_dirtree,4,10,140,525)
SendMessage_(GadgetID(#Gadget_Form1_dirtree),#TVM_SETBKCOLOR,0,8421631)
ListIconGadget(#Gadget_Form1_filebox,145,10,490,525,"ListIcon4",484,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
SendMessage_(GadgetID(#Gadget_Form1_filebox),#LVM_SETBKCOLOR,0,8421631)
SendMessage_(GadgetID(#Gadget_Form1_filebox),#LVM_SETTEXTBKCOLOR,0,8421631)
CreateStatusBar(#StatusBar_Form1,WindowID(#Window_Form1))
AddStatusBarField(420)
AddStatusBarField(110)
AddStatusBarField(110)
HideWindow(#Window_Form1,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
;
If Window_Form1()
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_EventMenu
Select EventMenuID()
Case #MenuBar_Form1_run : GoSub GetTree
Case #MenuBar_Form1_exit
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow And EventWindowID() = #Window_Form1
EndIf
End
;
GetTree:
ClearList(dir.s())
AddElement(dir())
dir() = "C:"
idx = 0
Repeat
SelectElement(dir(), idx)
If ExamineDirectory(0, dir(), "*.*")
path.s = dir() + "\"
quit = 0
Repeat
nextfile = NextDirectoryEntry()
filename.s = DirectoryEntryName()
Select nextfile
Case 0 : quit = 1 ; Nothing found
Case 1 : count + 1 ; Filename found
Case 2 ; Directory name found
filename.s = DirectoryEntryName()
If filename.s <> ".." And filename.s <> "."
AddElement(dir())
dir() = path + filename.s
levelpos = 1
node.s = dir()
ResetList(dir())
While StringField(node.s, levelpos, "\") <> ""
While NextElement(dir())
If node.s <> dir()
OpenTreeGadgetNode(#Gadget_Form1_dirtree)
AddGadgetItem(#Gadget_Form1_dirtree, -1, node.s)
Else
AddGadgetItem(#Gadget_Form1_dirtree, -1, node.s)
EndIf
Wend
levelpos + 1
Wend
For closenodes = 1 To levelpos
CloseTreeGadgetNode(#Gadget_Form1_dirtree)
Next closenodes
LastElement(dir())
EndIf
EndSelect
Until quit = 1
EndIf
idx + 1
Until idx > CountList(dir()) - 1
Return
;


