Next Previous Up Top Contents Index

5.3 DUIM-Sheets Module

choose-color

Generic function

Summary

Displays the built-in color dialog for the target platform.

Signature

choose-color #key frame owner title documentation exit-boxes name default => color

Arguments

frame
An instance of type <frame>. Default value: #f.

owner
An instance of type <sheet>. Default value: #f.

title
An instance of type <string>.

documentation
An instance of type <string>.

exit-boxes
An instance of type <object>.

name
An instance of type <object>.

default
An instance of type <object>.

Values

color
An instance of type <color>.

Library

duim-sheets

Module

duim-sheets

Description

Displays the built-in color dialog for the target platform, which allows the user to choose a color from the standard palette for whatever environment the application is running in.

Figure 5.1 The standard Choose Color dialog

If the frame argument is specified, the top-level sheet of frame becomes the owner of the dialog.

Alternatively, you can specify the owner directly using the owner argument, which takes an instance of <sheet> as its value.

By default, both frame and owner are #f, meaning the dialog has no owner. You should not specify both of these values.

If you wish, you can specify a title for the dialog; this is displayed in the title bar of the frame containing the dialog.

Example

The following example illustrates how you can define a class of frame that contains a button that displays the Choose Color dialog, using the pre-built dialog classes for your target environment. The frame also contains an ellipse whose color is set to the color chosen from the dialog.

define frame <color-dialog-frame> (<simple-frame>)
  pane ellipse-pane (frame)
    make(<ellipse-pane>, foreground: $red);
  pane choose-color-button (frame)
    make(<menu-button>,
         label: "Choose Color...",
         documentation: 
           "Example of standard 'choose color' dialog",
         activate-callback: 
           method (button)
           let color = choose-color(owner: frame);
           color & change-ellipse-color(frame, color)
           end);
end frame <color-dialog-frame>;

See also

choose-directory, page 222

choose-file, page 224

notify-user, page 315


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index