BUI logoBBjFileChooser::getDropZoneVisible

Description

In BBj 16.00 and higher, this method specifies whether a client-side BUI BBjFileChooser should include a drop zone where users can drag-and-drop files.

Syntax

Return Value

Method

boolean

getDropZoneVisible()

Parameters

None.

Return Value

Returns true (1) if the drop zone was requested, false (0) if it was not.

Remarks

Files dropped to the drop zone are immediately uploaded to the server, reporting a BBjFileChooserApproveEvent . The OK/Cancel control buttons are not used.

Example

rem ' BBjFileChooser::getDropZoneVisible

dropzone = 0
message$ = "Client File Chooser"
if (msgbox("FILEOPEN or FILESAVE?",7+32,message$,"FILEOPEN","FILESAVE") = 1) then
    flags$ = $0004$
    title$ = "Client FILEOPEN"
    if (info(3,6) = "5") then
        dropzone = 1, dropzone$ = $0000$
        if (msgbox("Show a drop zone?",4+32,"Drop Zone") = 6) then
            dropzone$ = $0004$; rem ' checkbox flags = initially checked
            flags$ = $0006$; rem ' $0002$ = BBjFileChooser::setDropZoneVisible(1)
            title$ = "Client FILEOPEN with drop zone"
        endif
    endif
else
    flags$ = $0104$
    title$ = "Client FILESAVE"
endif
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
tc! = bbjapi().getThinClient()
fs! = tc!.getClientFileSystem()
x = 100, y = 100, width = 400, height = 300
if info(3,6) = "5" then x = 20, y = 20, height = 200
window! = sysgui!.addWindow(x,y,width+50,height+50,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
directory$ = ""
chooser! = window!.addFileChooser(101,25,25,width,height,directory$,flags$)
chooser!.setMultiSelectionEnabled(1)
chooser!.addFileFilter("Text files","*.txt")
vector! = bbjapi().makeVector()
vector!.add("*.png")
vector!.add("*.gif")
vector!.add("*.bmp")
vector!.add("*.jpg")
chooser!.addFileFilter("Image files",vector!)
if (dropzone) then
    dropzone! = window!.addCheckBox(102,35,height-5,100,25,"Show Drop Zone",dropzone$)
    dropzone!.setCallback(dropzone!.ON_CHECK_ON,"showDropZone")
    dropzone!.setCallback(dropzone!.ON_CHECK_OFF,"hideDropZone")
endif
print "BBjFileChooser::getDropZoneVisible: ",chooser!.getDropZoneVisible()
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_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()
    i = msgbox(event$ + ": " + str(event!.getSelectedFiles()))
return

approve:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$,": ",event!.getSelectedFiles()
    i = msgbox(event$ + ": " + str(event!.getSelectedFiles()))
    if event!.getSelectedFiles().size() = 0 then return
    for i = 0 to event!.getSelectedFiles().size() - 1
        cf$ = event!.getSelectedFiles().get(i)
        cf! = fs!.getClientFile(cf$)
        print "getPath: ",cf!.getPath()
        path$ = cf!.copyFromClient()
        print "copyFromClient: ",path$
        print "exists: ",cf!.exists()
        print "size:",cf!.size()
    next i
return

cancel:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    print event$
    i = msgbox(event$)
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

showDropzone:
    chooser!.setDropZoneVisible(1)
    print "BBjFileChooser::getDropZoneVisible: ",chooser!.getDropZoneVisible()
return

hideDropzone:
    chooser!.setDropZoneVisible(0)
    print "BBjFileChooser::getDropZoneVisible: ",chooser!.getDropZoneVisible()
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjWindow::addFileChooser

BBjFileChooser::setDropZoneVisible

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