RequestFile() with Options button
BlitzMax Forums/BlitzMax Module Tweaks/RequestFile() with Options button
| ||
Want an options button in your save file dialog?:![]() Replace "brl.mod\system.mod\system.win32.cpp" with this: Open system.bmx and add an extra parameter at the end of RequestFile(): Function RequestFile$( text$,extensions$="",save_flag=False,initial_path$="",optionscallback:Byte Ptr=Null ) Open driver.bmx and add an extra parameter at the end of the RequestFile() method: Method RequestFile$( text$,exts$,save,file$,optionscallback:Byte Ptr ) Abstract Open SystemWin32.bmx and replace the RequestFile method with this: Basically, anywhere RequestFile() appears, you need to add the optional callback parameter at the end of it. Recompile brl.system and run this code: RequestFile("Options save file requester","All Files:*",1,"",SaveOptionsCallback)
Function SaveOptionsCallback()
w=300
h=400
win:TGadget=CreateWindow("Save Options",(Desktop().ClientWidth()-w)/2,(Desktop().ClientHeight()-h)/2,w,h,0,WINDOW_TITLEBAR+WINDOW_DIALOG)
button:TGadget=CreateButton("OK",win.clientwidth()/2-30,win.clientheight()-30,60,28,win)
Repeat
Select WaitEvent()
Case EVENT_WINDOWCLOSE
If EventSource()=win Exit
Case EVENT_GADGETACTION
If EventSource()=button Exit
EndSelect
Forever
FreeGadget win
EndFunction |
| ||
| not had time to test yet but thanks alot, can be very useful :D |
