I've created a much more fully featured File Selector (both save and load) for BlitzUI. Includes double click, extension filtering (multiple groups of extensions), overwrite warning, illegal character warning... It's very simple to include into your programs in with the BlitzUI code and should be flexible enough for almost any purpose.
Get it from the code archives now. Hope it's good for some people... If anyone notices anything wrong with it, can you let me know on [a mailto:contact@all-seeing-i.co.uk]contact@...]?
CHEERS!
Oh, maybe you'd like to try it with this simple program. Just save the following in a folder, and the Archive code as "save_gui.bb" in the same folder, then run this:
Graphics 640, 480, 32, 2
SetBuffer BackBuffer( )
HidePointer
Include "blitzui.bb"
;Load fonts and mouse cursors
;and collect information
Initialise( )
Include "save_gui.bb"
Global win1 = Window(10,10,100,60,"click these","0",1,0,0,0)
Global btn1 = Button(2,2,40,21,"save","0",1,0,0)
Global btn000002 = Button(50,2,40,21,"open","0",1,0,0)
Global img111
Repeat
If img111 Then DrawImage img111,500,40
;Draw the GUI and update the mouse
UpdateGUI( )
;Event Handling
Select app\Event
Case EVENT_WINDOW
Select app\WindowEvent
End Select
Case EVENT_MENU
Select app\MenuEvent
End Select
Case EVENT_GADGET
Select app\GadgetEvent
;save dialogue
Case btn1
fi$="All Files (.*);Image Files (.bmp .jpg .tif)*"
fi$=fi$+";Blitz Code (.bb);Executables (.exe)"
SAVE_DIALOGUE( fi$ , "" )
;open dialogue
Case btn000002
fi$="All Files (.*);Image Files (.bmp .jpg .tif)*"
fi$=fi$+";Blitz Code (.bb);Executables (.exe)"
OPEN_DIALOGUE( fi$ )
End Select
FILE_SELECTOR_GADGETS
End Select
SAVE_GUI_OTHER_FUNCTIONS
;Draw the mouse
DrawMouse( )
;Reset all GUI events
ResetEvents( )
Flip
Cls
Until KeyHit( 1 ) Or app\Quit = True
;Free all images and controls created by BlitzUI
Destroy( )
End
;-------------------------------------------------------
Function SAVE(f$)
If img111 Then SaveImage(img111,f$)
End Function
;-------------------------------------------------------
Function OPEN(f$)
If img111>0 Then FreeImage img111
img111=LoadImage(f$)
ResizeImage img111,100,100
End Function
|