It is currently Sun Jun 25, 2017 8:47 pm

Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: File Picking Function
Unread postPosted: Sun Apr 16, 2017 3:32 pm 

Joined: Sat Jul 04, 2015 7:28 am
Posts: 51

Fn.Def Extension (FileName$, Type$)
Correct = 1
Extension$ = Upper$ (Right$ (FileName$, 3))
If Extension$ <> "JPG" & Extension$ <> "PNG" & Type$ = "Graphics" Then Correct = 0
If Extension$ <> "TXT" & Type$ = "Text" Then Correct = 0
If Extension$ <> "BIN" & Type$ = "Binary" Then Correct = 0
Fn.Rtn Correct

Fn.Def PickFile$(Type$)
flag = 0
file.dir "", Existing$[]
Array.length filecount, Existing$[]
list.create s, allfiles
for count = 1 to filecount
if Extension(Existing$[count], Type$) = 1 then list.add allfiles, Existing$[count]
list.size allfiles, filecount
list.toarray allfiles, FilesofType$[]
Array.length filecount, Filesoftype$[]
if filecount > 0 then Filesoftype$[1] = ">" + Filesoftype$[1]
FileSelect = GW_NEW_PAGE()
Message$ = "Select a " + Type$ + " File:"
GW_ADD_TITLEBAR (FileSelect,Message$)
myselbx = GW_ADD_SELECTBOX(FileSelect, "" ,FilesofType$[])
GW_ADD_LISTENER (FileSelect, myselbx, "Submit", "Submit")
inpaxn3 = GW_ADD_SUBMIT (FileSelect, "Select")
GW_RENDER (FileSelect)
if is_in (GW_ID$(inpaxn3), r$) then
File = GW_GET_VALUE(myselbx)
If File < 1 then File = 1
File$ = FilesofType$[File]
GW_CLOSE_PAGE (FileSelect)
Fn.Rtn File$

Report this post
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: