PreviousNextIndex

SYSTEM-DIALOG COLOR statement


(Windows only; Graphical interfaces only)

Displays a dialog box that lets the user choose and associate a system color with the specified dynamic color number. The SYSTEM-DIALOG COLOR statement provides a dialog box appropriate to the graphical environment in which it runs.

Note: Does not apply to SpeedScript programming.
Syntax

SYSTEM-DIALOG COLOR color-number 
  [ UPDATE logical-variable ] 
  [ IN WINDOW window ] 

color-number
UPDATE logical-variable
IN WINDOW window
Example

The following procedure displays a dialog box that allows the user to assign new foreground and background colors to the dialog box. A radio set in the dialog box lists selections for foreground and background that correspond to the numbers nine and eight, respectively. Choosing the OK button opens a color dialog box to assign a new system color to the selected color number. Note that the UPDATE option is not used to return a termination status because the dialog does not require the user to select a new color; it only provides the option. The procedure terminates when the user chooses the Cancel button in the radio selection dialog box.

r-coldlg.p
DEFINE VARIABLE front-color AS INTEGER NO-UNDO INITIAL 9. 
DEFINE VARIABLE back-color  AS INTEGER NO-UNDO INITIAL 8. 
DEFINE VARIABLE curr-color  AS INTEGER NO-UNDO INITIAL 9 
  VIEW-AS RADIO-SET RADIO-BUTTONS "Foreground", 9, "Background", 8. 
DEFINE BUTTON ok-button     LABEL "OK". 
DEFINE BUTTON cancel-button LABEL "Cancel" AUTO-ENDKEY. 
FORM 
  SKIP(0.5) SPACE(0.5) 
  curr-color SPACE(2) ok-button SPACE(2) cancel-button 
  SPACE(0.5) SKIP(0.5) 
  WITH FRAME color-frame NO-LABELS TITLE "Choose frame colors ..." 
    FGCOLOR front-color BGCOLOR back-color VIEW-AS DIALOG-BOX. 
ON CHOOSE OF ok-button IN FRAME color-frame DO: 
  ASSIGN curr-color. 
  IF NOT COLOR-TABLE:GET-DYNAMIC(curr-color) AND 
     NOT COLOR-TABLE:SET-DYNAMIC(curr-color,TRUE) THEN 
    MESSAGE "Color must be DYNAMIC to edit.". 
  ELSE  
    SYSTEM-DIALOG COLOR curr-color. 
END. 
UPDATE curr-color ok-button cancel-button WITH FRAME color-frame. 

Note that the trigger for the ok-button must assign the curr-color variable to obtain the latest value selected for the radio set. The GET-DYNAMIC and SET-DYNAMIC methods are used to ensure that the color is dynamic before modifying it.

Notes
See also

COLOR phrase, COLOR-TABLE system handle


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex