Dlg Color Command

Purpose

calls the common color selecting dialog box for a form.

Syntax

Dlg Color form, Flags , custcol(), color

formForm object
Flagsiexp (CC_ constants)
cust()ivar
color:ivar

Description

form - A Form object, for instance Me, Win_1, Dlg_1, frm1, etc.

Flags - Sets several options of the Dialog box.

CC_RGBINIT ($1) color will be used as default.
CC_FULLOPEN ($2) The whole Dialog box appears immediately, otherwise just the left side with pre-defined Custom Colors appears.
CC_PREVENTFULLOPEN($4) The right side of the Dialog box is switched off, preventing the creation of new Custom Colors.
Not allowed are: CC_SHOWHELP ($8)
CC_ENABLEHOOK ($16)
CC_ENABLETEMPLATE ($32)
CC_ENABLETEMPLATEHANDLE ($64)

custcol() - A long integer field, holds the Custom Colors in first 16 elements.

color - A long integer variable, holds a default color-selection. In this command, colors are always RGB values.

_AX is a null if there is an error. Otherwise, color% is the newly selected color. cust%() is filled with the new Custom Colors.

Example

Print                        // Open window #1

Dim col(0 .. 15) As Int, c As Int, i As Int

For i = 0 To 15

col(i) = QBColor(i)        // Custom colors

Next

Dlg Color Me, 0, col(), c    // Dialog

If _AX

Color c : Print (Hex(c))   // Print in color

For i = 0 To 15

Color col(i) : Print Hex(col(i), 8),

If i Mod 4 = 0 Then Print

Next

Color 0 : Print (Hex(c))   // Print in black

For i = 0 To 15

Print Hex(col(i), 8),

If i Mod 4 = 0 Then Print

Next

EndIf

This small program produces a color-selector and evaluates the selection.

Remarks

This command is implemented for compatibility reasons only. Use CommDlg object instead.

See Also

CommDlg, Color, Dlg Font, Dlg Open, Dlg Print, Rgb(), RGBColor

{Created by Sjouke Hamstra; Last updated: 02/10/2014 by James Gaite}