BBjFileChooser::setView

Description

In BBj 20.30 and higher, this method attempts to set the BBjFileChooser view. This functionality is dependent on the BBjFileChooser configuration and the client look and feel; some environments will ignore this method.

Syntax

Return Value Method
void setView(boolean detail, int column, int order, ...)

Parameters

Parameter Description
detail true (1) for detail view, false (0) for grid view.
column Zero-based column number in the detail view.
order
Value Description
-1 Descending
0 Unsorted
1 Ascending
...

Multiple column, order pairs may be specified, although the look and feel may only honor the first pair.

Return Value

None.

Remarks

This functionality can only make a best-effort attempt to honor the specified view settings. This method may be ignored in some BBjFileChooser configurations and some look and feel environments.

rem ' BBjFileChooser::setView
title$ = "BBjFileChooser::setView"
width = 800
height = 500
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,width+50,height+50,title$,$00090003$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")
directory$ = dsk("") + dir("")
directory$ = System.getProperty("user.home")
chooser! = window!.addFileChooser(101,25,25,width,height,directory$,$0004$)
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")
chooser!.setView(1,3,-1); rem ' Detail view, column 3, descending
process_events
eoj:
  release
change:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,": ",event!.getSelectedFiles(),"; ",chooser!.getText()
return
approve:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,": ",event!.getSelectedFiles(),"; ",chooser!.getText()
return
cancel:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,"; ",chooser!.getText()
return
filter:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,": ",event!.getActiveFileFilter(),"; ",chooser!.getText()
  chooser!.setView(1,3,-1); rem ' Detail view, column 3, descending
return
event:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  control! = event!.getControl()
  control$ = control!.toString(), control$ = control$(1,pos("@"=control$)-1)
  print control$," ",event$,"; ",chooser!.getText()
return
resize:
  event! = sysgui!.getLastEvent()
  chooser!.setSize(event!.getWidth()-50,event!.getHeight()-50)
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjFileChooser

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