BBjFileChooser::isMultiSelectionEnabled

Description

In BBj 7.00 and higher, this BBjFileChooser method returns whether the user may select more than one file.

Syntax

Return Value

Method

boolean

isMultiSelectionEnabled()

Parameters

None.

Return Value

Returns 1 if multiselection is enabled, and 0 if not.

Example

sg = unt
open(sg)"X0"

api! = BBjAPI()
sg! = api!.getSysGui()
window! = sg!.addWindow(100, 100, 500, 350, "File Chooser", $00010083$, $$)
pwd$ = DIR("")
fc! = window!.addFileChooser(101, 0, 0, 500, 300, pwd$, $0004$)
selectButton! = window!.addButton(102, 200, 310, 100, 30, "Select files")
parentButton! = window!.addButton(103, 310, 310, 100, 30, "Parent Directory")
if (! fc!.isMultiSelectionEnabled())
    fc!.setMultiSelectionEnabled(1)
endif
fc!.setFileSelectionMode(fc!.FILES_AND_DIRECTORIES)

selectButton!.setCallback(api!.ON_BUTTON_PUSH, "SELECT_FILES")
parentButton!.setCallback(api!.ON_BUTTON_PUSH, "PARENT_DIR")
fc!.setCallback(api!.ON_FILECHOOSER_APPROVE, "DO_APPROVE")
fc!.setCallback(api!.ON_FILECHOOSER_CANCEL, "DO_CANCEL")

window!.setCallback(api!.ON_CLOSE, "DO_CLOSE")

process_events

DO_CLOSE:
release

SELECT_FILES:
    dirCh = UNT
    pwd$ = fc!.getCurrentDirectory()
    open(dirCh)pwd$
    readrecord(dirCh)dummy$
    readrecord(dirCh)dummy$
    readrecord(dirCh)file1$
    readrecord(dirCh)file2$
    vec! = api!.makeVector()
    vec!.addItem(pwd$ + "/" + file1$)
    vec!.addItem(pwd$ + "/" + file2$)
    fc!.setSelectedFiles(vec!)
return

PARENT_DIR:
    fc!.changeToParentDirectory()
return

DO_APPROVE:
    ev! = BBjAPI().getLastEvent()
    vec! = ev!.getSelectedFiles()
    for idx = 0 to vec!.size() - 1
        if (vec!.size() > 0)
            file$ = vec!.get(idx)
            PRINT file$
        endif
    next idx
    window!.destroy()
END

DO_DIALOG_CANCEL:
    fc!.cancelSelection()
return

DO_CANCEL:
    PRINT "File selection cancelled"
END

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjFileChooser::setMultiSelectionEnabled

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.