G4C

; DIRECTORY LISTVIEWS

; A directory lv is like the listers you find in DirOpus and other
; file managers. They are multi-selectable and have dedicated
; commands. There is much more that can be done with them than
; is shown here.. (look at dir.gc)


WINBIG 156 31 300 177  ListViews3.gc
WinType 11110001

xOnLoad
GuiOpen ListViews3.gc

xOnClose
GuiQuit ListViews3.gc

; ------------------------------------------------------------------
; 	The directory listview
; ------------------------------------------------------------------

; Note that (like multi-lv's) these lv's "happen" when the user
; double clicks them. 

; In this case, if the item double-clicked is a directory, then it
; will be entered into automatically and the xLVDirHook event will 
; be executed.

; If it's a file, then the commands attached to the LV will be
; executed. In this case, it's only one command - the GuiLoad -
; which loads the gui "FilePop" which resides in guis:tools/rtn
; to handle the file. Look at the "Routines.guide" for more info
; on this gui

XLISTVIEW 5 2 207 172 "" lv.file "" 10 DIR
gadid 1                              ; the ID of our listview
gadfont #mono 8 000                  ; Use the default monospace font
lvdirhook 1                          ; the number of the LVDirHook event
GuiLoad guis:tools/rtn/FilePop $Listviews3.gc/lv.file


; -------- The LVHook event

; This is the xLVDirHook event that will be executed on double-clicking
; a directory - we use it to update the window's title with the name
; of the directory our listview is at.

xLVDirHook 1
setwintitle listviews3.gc '$$lv.dir                       '


; ------------------------------------------------------------------
; 	The buttons..
; ------------------------------------------------------------------

; These buttons will control our dir listview..


XBUTTON 215 2 81 14 "Parent"       ; go to the parent dir
lvuse listviews3.gc 1
lvdir parent
setwintitle listviews3.gc '$$lv.dir                       '

XBUTTON 215 16 81 14 "Root"        ; go to the root of the drive
lvuse listviews3.gc 1
lvdir root
setwintitle listviews3.gc '$$lv.dir                       '

XBUTTON 215 30 81 14 "Disks"       ; show the device list
lvuse listviews3.gc 1
lvdir disks
setwintitle listviews3.gc 'Device list'


XBUTTON 215 50 81 14 "All"         ; select all dirs/files
lvuse listviews3.gc 1
lvdir all

XBUTTON 215 64 81 14 "None"        ; unselect all selected items
lvuse listviews3.gc 1
lvdir none


; ------------------------------------------------------------------
;	The List button
; ------------------------------------------------------------------

; This button will list out all the selected items, stating what
; type they are.. Note that the device list can never be acted upon..
; It's done for safety, so that gems like "delete DH0:" can be avoided

XBUTTON 215 88 81 14 "List"
lvuse listviews3.gc 1              ; use our listview
lvmulti first                      ; goto to first selected item
while $$lv.line > ''               ; while there are selected items..
      say '$$lv.type - $$lv.rec\n' ; show the type & name of each item
      lvmulti off                  ; un-select the item
      lvmulti next                 ; get next item
endwhile                           ; until no more..



; Easy, wasn't it ?




