open

open(): Integer updating;

The open method of the CMDColor class initiates the common Color dialog for the CMDColor class and returns a value indicating the success of the user actions, as listed in the following table.

Value Description
0 User clicked the OK button. Values of the selections made are returned.
1 User clicked the Cancel button.
Other Error number indicating a Windows fault number associated with the execution of the dialog.

The position of the displayed common Color dialog cannot be determined. The values of the variable options for the class should be set before the open method is used.

The following example shows the use of the open method to open the common Color dialog.

vars
    colDlg : CMDColor;
begin
    create colDlg;
    colDlg.color := backColor;              // set initial color displayed
    if colDlg.open = 0 then                 // not cancelled and no error
        backColor := colDlg.color;          // use the returned value
    endif;
epilog
    delete colDlg;                          // tidy
end;

Any values that are returned are retained if further calls are made on the class instance. The object should be deleted when it is no longer required.

An exception is raised if this method is invoked from a server method.