Generic function
Displays the built-in color dialog for the target platform.
choose-color #key frame owner title documentation exit-boxes name default => color
<frame>. Default value: #f.
<sheet>. Default value: #f.
<string>.
<string>.
<object>.
<object>.
<object>.
<color>.
duim-sheets
duim-sheets
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.
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.
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>;