BBjFileChooserFilterEvent::getActiveFileFilter

Description

In BBj 13.0 and later, this method returns the BBjFileChooser's active file filter.

Syntax

Return Value

Method

string

getActiveFileFilter()

Parameters

None.

Return Value

Returns the file filter currently active on the BBjFileChooser. A value of "" indicates the default "All Files" filter.

Remarks

None.

Example

rem ' filechooser.txt

locale$ = stbl("!LOCALE","en_US")
flags$ = $0000$
if (msgbox("Client filesystem?",4+32+256)=6) then
    flags$ = ior(flags$,$0004$)
    title$ = "Client"
else
    title$ = "Server"
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()
width = 400, height = 300
window! = sysgui!.addWindow(100,100,width+50,height+50,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
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")
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!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$,": ",event!.getSelectedFiles()
return

approve:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$,": ",event!.getSelectedFiles()
return

cancel:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$
return

filter:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$,": ",event!.getActiveFileFilter()
return

event:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    control! = event!.getControl()
    control$ = control!.toString(), control$ = control$(1,pos("@"=control$)-1)
    print control$," ",event$
return

See Also

BBjAPI

BBj Object Syntax

BBjFileChooser

BBj Object Diagram for an illustration of the relationship between BBjObjects.