BBjFileChooser::changeToParentDirectory

Description

In BBj 7.0 and higher, invoke this method to programmatically show the parent directory of the current directory shown in the file chooser.

Syntax

Return Value

Method

void

changeToParentDirectory()

Parameters

None.

Return Value

None.

Remarks

The BUI client-side file chooser ignores this method. See BUI: Interacting with client files for a detailed discussion of the BUI client-side file choosers.

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")
fc!.setMultiSelectionEnabled(1)
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

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