2015-05-05 21:04:32 -07:00
|
|
|
#!yab
|
|
|
|
|
|
|
|
|
2015-04-13 13:40:27 -07:00
|
|
|
import Filebox
|
|
|
|
|
|
|
|
|
|
|
|
dir$ = "/boot/home/"
|
|
|
|
|
2015-05-05 21:04:32 -07:00
|
|
|
window open 100,100 to 500,500, "Demo",dir$
|
2015-04-13 13:40:27 -07:00
|
|
|
Filebox(10,10,350,390,"Filebox", 1, "Demo")
|
|
|
|
FileboxDirectory("Filebox", dir$, false)
|
|
|
|
button 360,10,390,30, "DirUp", "..", "Demo"
|
|
|
|
|
|
|
|
dim msg$(1)
|
|
|
|
inloop = true
|
|
|
|
while(inloop)
|
|
|
|
n = split(message$, msg$(), "|")
|
|
|
|
for i=1 to n
|
2015-05-05 21:04:32 -07:00
|
|
|
print msg$(i)
|
2015-04-13 13:40:27 -07:00
|
|
|
// Quit
|
|
|
|
if(msg$(i) = "Demo:_QuitRequested") inloop = false
|
|
|
|
|
|
|
|
// Button pressed and we are not in the root directory
|
|
|
|
if(msg$(i) = "DirUp" and dir$<>"/") then
|
|
|
|
t = len(dir$)-1
|
|
|
|
while(mid$(dir$,t,1)<>"/")
|
|
|
|
t = t - 1
|
|
|
|
wend
|
|
|
|
dir$ = left$(dir$,t)
|
2015-05-05 21:04:32 -07:00
|
|
|
WINDOW SET "Demo", "Title", dir$
|
2015-04-13 13:40:27 -07:00
|
|
|
FileboxDirectory("Filebox", dir$, false)
|
2015-05-05 21:04:32 -07:00
|
|
|
|
2015-04-13 13:40:27 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
// An item is invoked
|
|
|
|
if(instr(msg$(i),"Filebox:_Invoke:")) then
|
|
|
|
position = val(right$(msg$(i),len(msg$(i))-16))
|
|
|
|
|
|
|
|
// if the item is a directory, then update the filebox else print the filename
|
2015-05-05 21:04:32 -07:00
|
|
|
if(FileboxIsDirectory("Filebox", position,dir$)) then
|
2015-04-13 13:40:27 -07:00
|
|
|
dir$ = dir$ + FileboxName$("Filebox", position) + "/"
|
2015-05-05 21:04:32 -07:00
|
|
|
WINDOW SET "Demo", "Title", dir$
|
2015-04-13 13:40:27 -07:00
|
|
|
FileboxDirectory("Filebox", dir$, false)
|
|
|
|
else
|
2015-05-05 21:04:32 -07:00
|
|
|
print dir$+FileboxName$("Filebox", position)
|
2015-04-13 13:40:27 -07:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
next i
|
|
|
|
|
|
|
|
sleep 0.01
|
|
|
|
wend
|
|
|
|
|
|
|
|
window close "Demo"
|