Re: What I did with Rev last night - few lines of code for graphical file/folder/volume navigator

2007-07-06 Thread viktoras didziulis
Whoops, Thunderbird reformatted the e-mail, so likely you won't be able 
to get it running after copying/pasting the code from my previous message.
Here is a sample stack with a field using these 3 short handlers if 
anyone is interested:

go stack URL "http://www.ekoinf.net/File_browser.rev";

feel free to reuse it :-)

All the best
Viktoras

viktoras didziulis wrote:
Didn't expect programming an embedded volumes/folders/files navigator 
can be so easy. If you need something like this in your application, 
use the source below - just copy/paste the 3 handlers from this 
message into a scrolling field. In object inspector check the lock 
text and the list behavior of the field to true or ---


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: What I did with Rev last night - few lines of code for graphical file/folder/volume navigator

2007-07-06 Thread viktoras didziulis
Didn't expect programming an embedded volumes/folders/files navigator 
can be so easy. If you need something like this in your application, use 
the source below - just copy/paste the 3 handlers from this message into 
a scrolling field. In object inspector check the lock text and the list 
behavior of the field to true or execute:

set the lockText of fld "yourField" to true
set the listBehavior of fld "yourField" to true
in the message box. Then click the field with mouse and start using it.

on mouseDown
 if me is not empty then
   pass mouseDown
 else
   put the folders & return & return & the files into me   
 end if

 drawList
end mouseDown

on selectionChanged
 local myLine   
 if ".." is in the selectedtext then
   set the defaultfolder to (the defaultfolder & "/" & char 3 to -1 of 
the selectedtext)

 else if char 2 to 3 of the selectedtext = "  " then
   #insert your handler for the selected files here
answer "file:" && the defaultfolder & "/" & char 4 to -1 of the 
selectedtext

 else if ":" is in the selectedtext then
   set the defaultfolder to (char 3 to -1 of the selectedtext & "/")
 else   
   set the defaultfolder to (the defaultfolder & "/" & char 3 to -1 of 
the selectedtext)
 end if
 drawList

end selectionChanged

on drawList
 local myLine
 local flag
 put 0 into flag 
 lock screen
 put the defaultfolder & return & the volumes & return & the folders & 
return & return & the files into me

 repeat with i = 1 to the number of lines in me
   put line i of me into myLine
   if myLine is empty then
 put 1 into flag
 next repeat  
   else
 if flag = 1 then #files   
   put "   " before line i of me   
   set the imageSource of char 1 of line i of me to 201066  
 else #folders or volumes  
   put "  " before line i of me  
   set the imageSource of char 1 of line i of me to 210087

 end if
   end if 
 end repeat 
 set the imageSource of char 1 of line 1 of me to 210088
 set the textStyle of line 1 of me to "bold" 
 unlock screen

end drawList

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution