PreviousNextIndex

SELECTION-LIST phrase

Describes the selection-list representation of a field or variable. A selection-list is a scrollable list of values. The SELECTION-LIST phrase is an option of the VIEW-AS phrase.

Note: Does not apply to SpeedScript programming.
Syntax

SELECTION-LIST 
  [ SINGLE | MULTIPLE ] 
  [ NO-DRAG ] 
  { LIST-ITEMS item-list | LIST-ITEM-PAIRS item-pair-list } 
  [ SCROLLBAR-HORIZONTAL ]  
  [ SCROLLBAR-VERTICAL ] 
  {   size-phrase  
    | { INNER-CHARS cols INNER-LINES rows } 
  } 
  [ SORT ] 
  [ TOOLTIP tooltip ] 

SINGLE
MULTIPLE
NO-DRAG
LIST-ITEMS item-list
LIST-ITEM-PAIRS item-pair-list
label
value
SCROLLBAR-VERTICAL
SCROLLBAR-HORIZONTAL
size-phrase
INNER-CHARS cols INNER-LINES rows
SORT
TOOLTIP tooltip
Example

The r-select.p procedure prompts the user for a directory name and then populates a selection-list with the contents of the specified directory. After the user selects an item from the selection-list, the procedure echoes back the selection.

The procedure uses the INPUT FROM statement to read the contents of the user-specified directory and creates a comma-separated list of all the file and directory names in the directory. It then assigns the comma-separated list to the LIST-ITEMS attribute of the selection-list. Because an assignment to an attribute depends on the widget being located in a frame, the DEFINE FRAME statement is used to locate the selection-list.

r-select.p
DEFINE VARIABLE f-name        AS CHARACTER NO-UNDO FORMAT "x(14)". 
DEFINE VARIABLE choice        AS CHARACTER NO-UNDO FORMAT "x(50)" 
  LABEL "You have selected". 
DEFINE VARIABLE list_contents AS CHARACTER NO-UNDO FORMAT "x(200)". 
DEFINE VARIABLE dir           AS CHARACTER NO-UNDO FORMAT "x(40)"  
  LABEL "Please enter a directory pathname ". 
DEFINE VARIABLE sl            AS CHARACTER NO-UNDO  
  VIEW-AS SELECTION-LIST INNER-CHARS 15 INNER-LINES 10 SORT. 
DEFINE FRAME b sl. 
DEFINE FRAME c choice. 
DEFINE STREAM dirlist. 
ENABLE dir WITH FRAME d WITH SIDE-LABELS. 
ON RETURN OF dir IN FRAME d DO: 
  ASSIGN FRAME d dir. 
  INPUT STREAM dirlist FROM OS-DIR (dir). 
  IMPORT STREAM dirlist f-name. 
  list_contents = f-name. 
  REPEAT:    
    IMPORT STREAM dirlist f-name. 
    list_contents = list_contents + "," + f-name. 
  END. 
  INPUT CLOSE. 
  sl:LIST-ITEMS IN FRAME b = list_contents. 
  ENABLE sl WITH FRAME b NO-LABELS TITLE "Please Select a File" WIDTH 50. 
END. 
ON VALUE-CHANGED OF sl IN FRAME b DO: 
  choice = sl:SCREEN-VALUE. 
  DISPLAY choice WITH FRAME c SIDE-LABELS. 
END. 
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

Notes
See also

SIZE phrase, VIEW-AS phrase


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex