News:

Function Finder  Find all the functions within source code files

Main Menu

Selecting a file..

Started by AndyD, June 26, 2012, 07:08:48 AM

Previous topic - Next topic

AndyD

Hi folks,

I am currently messing around with playbasic, hoping to create a small app that will manipulate images to help with a papercraft project I am working on.

Is it possible in playbasic to manually select files using a file selector? It is probably a really dumb question but I have looked through the playbasic help and can't find an example of one being used.

kevin

#1
 LoadDialog sounds like what you want.   It's in the help under  Libraries / PB_Dialogs.   That library has a bunch of windows dialog controls in it..

PlayBASIC Code: [Select]
; Inlcude the Dialogs library in this program
#include "PBDialogs"


; Title Of the Dialog
Title$="Load A Text File"

; Pre-seed the file name we're expecting to find
Filename$="Some Cool FIle.txt"


; Filter$="" ; No Filter show all files
Filter$ ="(*.TXT)|*.TXT" ; Only TXT files
; Filter$ ="(*.PNG)|*.PNG" ; Only PNG files
; Filter$ ="(*.BMP)|*.BMP" ; Only BMP Files
; Filter$ ="(*.Jpeg)|*.JPG" ; Only JPG files
; Filter$ ="(*.Images)|*.JPG;*.bmp;*.PNG;*gif" ; Mixture of image files


; Call the Load Dialog
File$=LoadDialog(Title$,Filename$,Filter$)


; Display the file you selected
Print "You Selected "

; Display the Info about this file$
If FileExist(file$)
Print "Path:"+FIle$
Print "Size:"+Str$(FileSize(File$))+" Bytes"

Else
Print "No file Was Selected"

EndIf

// Display the screen & wait for a key press to end
Sync
WaitKey




AndyD

Hi Kevin,

That is exactly what I am looking for.

Many thanks!