DISPLAY COLOR statement

Purpose

Display a color selection dialog to return the user's choice.

Syntax

DISPLAY COLOR [hParent], [xpos&], [ypos&], firstcolor&, custcolors, flags& TO colorval&

hParent

Handle of the parent window or dialog.  If there is no parent, use zero (0) or %HWND_DESKTOP.

xpos&

Horizontal position, in pixels, relative to the parent window.  If omitted, PowerBASIC selects the position (offset from the parent, or centered if no parent).

ypos&

Vertical position, in pixels, relative to the parent window.  If missing, PowerBASIC selects the position (offset from the parent, or centered if no parent).

firstcolor&

Specifies the RGB color which is initially selected when the dialog box is created.

custcolors

User-Defined Type variable which is used to initialize and return 16 custom colors on the dialog.  The UDT must have 16 members, each of which is a long integer or dword. They may be scalar members, or a member array.

flags&

The style attributes of the COLOR Dialog.  The following values may be used alone or combined, and are predefined in the PowerBASIC compiler:

%CC_FULLOPEN

Causes the entire dialog box to appear when created, including the section which allows the user to create custom colors.

%CC_PREVENTFULLOPEN

Disables the "Define Custom Colors" button, preventing the creation of custom colors.

%CC_SHOWHELP

Causes the Help Button to be displayed. The hParent parameter must not be zero or %HWND_DESKTOP.

colorval&

The RGB value of the selected color.  If the user fails to make a color selection, or chooses CANCEL, the value -1 is assigned to the colorval& variable.

Remarks

If you offer the user the ability to create custom colors, it is suggested you retain the custcolors& UDT variable without change.  It may then be used again on a later invocation of DISPLAY COLOR with the user's custom colors intact.

See also

Built In RGB Color Equates, DISPLAY BROWSE, DISPLAY FONT, DISPLAY OPENFILE, DISPLAY SAVEFILE, RGB