rem ' BBjFileChooser::getCancelButtonText Example
rem ' BBjFileChooser
flags$ = $0000$
width = 800
if (msgbox("Client filesystem?",4+32)=6) then
flags$ = ior(flags$,$0004$)
title$ = "Client"
height = 400
else
title$ = "Server"
height = 800
endif
if (msgbox("Save-style dialog?",4+32+256)=6) then
flags$ = ior(flags$,$0100$)
title$ = title$ + " Save"
else
title$ = title$ + " Open"
endif
if (msgbox("Directory chooser?",4+32+256)=6) then
flags$ = ior(flags$,$0008$)
title$ = title$ + " Directory"
else
title$ = title$ + " File"
endif
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,width+50,height+50,title$,$00090003$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")
directory$ = System.getProperty("user.home")
directory$ = dsk("") + dir("")
chooser! = window!.addFileChooser(101,25,25,width,height,directory$,flags$)
vector! = bbjapi().makeVector()
vector!.add("*.gif")
vector!.add("*.jpg")
vector!.add("*.png")
vector!.add("*.bmp")
vector!.add("*.ico")
chooser!.addFileFilter("Image Files", vector!)
chooser!.addFileFilter("Text Files", "*.txt")
chooser!.setActiveFileFilter("Text Files")
print "getApproveButtonText: ",chooser!.getApproveButtonText()
print "getCancelButtonText: ",chooser!.getCancelButtonText(err=*next)
System.err.println("getApproveButtonText: "+chooser!.getApproveButtonText())
System.err.println("getCancelButtonText: "+chooser!.getCancelButtonText(err=*next))
chooser!.setApproveButtonText("Approve")
chooser!.setCancelButtonText("Cancel",err=*next)
chooser!.setCallback(chooser!.ON_FILECHOOSER_CHANGE,"change")
chooser!.setCallback(chooser!.ON_FILECHOOSER_APPROVE,"approve")
chooser!.setCallback(chooser!.ON_FILECHOOSER_CANCEL,"cancel")
chooser!.setCallback(chooser!.ON_FILECHOOSER_FILTER,"filter")
chooser!.setCallback(chooser!.ON_GAINED_FOCUS,"event")
chooser!.setCallback(chooser!.ON_LOST_FOCUS,"event")
chooser!.setCallback(chooser!.ON_MOUSE_ENTER,"event")
chooser!.setCallback(chooser!.ON_MOUSE_EXIT,"event")
chooser!.setCallback(chooser!.ON_POPUP_REQUEST,"event")
chooser!.setCallback(chooser!.ON_RIGHT_MOUSE_DOWN,"event")
process_events
eoj:
release
change:
event! = sysgui!.getLastEvent()
event$ = event!.getEventName()
print event$,": ",event!.getSelectedFiles(),"; ",chooser!.getText()
return
approve:
event! = sysgui!.getLastEvent()
event$ = event!.getEventName()
print event$,": ",event!.getSelectedFiles(),"; ",chooser!.getText()
return
cancel:
event! = sysgui!.getLastEvent()
event$ = event!.getEventName()
print event$,"; ",chooser!.getText()
return
filter:
event! = sysgui!.getLastEvent()
event$ = event!.getEventName()
print event$,": ",event!.getActiveFileFilter(),"; ",chooser!.getText()
return
event:
event! = sysgui!.getLastEvent()
event$ = event!.getEventName()
control! = event!.getControl()
control$ = control!.toString(), control$ = control$(1,pos("@"=control$)-1)
print control$," ",event$,"; ",chooser!.getText()
return
resize:
event! = sysgui!.getLastEvent()
chooser!.setSize(event!.getWidth()-50,event!.getHeight()-50)
return
|