BBjFileChooser::changeToParentDirectory

Description

In BBj 7.00 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.

BUI logoRemarks

The BUI client-side file chooser ignores this method. See Interacting with client files in BUI and DWC for a detailed discussion of the BUI and DWC 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

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