Alternative name: ChooseColour
The ChooseColor class implements the pre-defined color-selection dialog. This is a top-level object (i.e. it should not be opened as the child of a window).
To use the dialog, you must first create it using
The style property applies to Windows only (it is ignored under MacOS and Linux). It defines whether the user can select custom colors, by selecting one of:
0 = Allow custom colours 1 = Open with custom colours displayed 2 = Disallow custom colors
You can also add the following to style:
4 = Return nearest solid colour 8 = Allow any colour, dither if necessary
Under Windows and Linux, you can pre-define up to 16 custom colors by setting the custom property, as a vector of 16 integers representing the RGB values of each color. (This property is ignored under MacOS).
To set the color which will be selected when the dialog is shown, you can assign a value to the color property.
When you are ready to show the dialog, call the Show method. This displays the modal dialog. The user can then select a color; if the Cancel button is pressed, the Show method returns 0. If the OK button is pressed, the Show method returns 1. You can then read the color property to retrieve the color selected by the user (only the first element is used); if this is
∇DEMO_ChooseColor;DLG  ⍝ Sample function demonstrating use of the ChooseColor object  DLG←'⎕' ⎕NEW 'ChooseColor'  ⍝ Show the dialog. If user presses Cancel, quit  :If 1=DLG.Show  ⍝ He pressed OK.  'Color chosen: ',⍕1↑DLG.color  :EndIf ∇
Copyright © 1996-2010 MicroAPL Ltd