COLORCHOOSERDIALOG: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
{{PageExamples}} | {{PageExamples}} | ||
; Example : | ; Example : Color selection | ||
{{CodeStart}} | {{CodeStart}} | ||
mycolor~& = {{Cl|_COLORCHOOSERDIALOG}}("Select a color", {{Cl|_RGB32}}(0, 255, 255)) | mycolor~& = {{Cl|_COLORCHOOSERDIALOG}}({{Text|<nowiki>"Select a color"</nowiki>|#FFB100}}, {{Cl|_RGB32}}({{Text|0|#F580B1}}, {{Text|255|#F580B1}}, {{Text|255|#F580B1}})) | ||
{{Cl|IF}} mycolor~& <> 0 {{Cl|THEN}} {{Cl|_MESSAGEBOX}} "Information", "You selected " + {{Cl|HEX$}}(mycolor~&) | {{Cl|IF}} mycolor~& <> {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|_MESSAGEBOX}} {{Text|<nowiki>"Information"</nowiki>|#FFB100}}, {{Text|<nowiki>"You selected "</nowiki>|#FFB100}} + {{Cl|HEX$}}(mycolor~&) | ||
{{CodeEnd}} | {{CodeEnd}} | ||
Revision as of 21:46, 20 March 2023
The _COLORCHOOSERDIALOG function displays a standard color picker dialog box. It returns a 32-bit RGBA color with the alpha channel set to &HFF (255). A zero is returned if the user cancelled.
Syntax
- color32bpp~& = _COLORCHOOSERDIALOG(title$[, defaultRGB~&])
Parameters
- title$ is the dialog box title
- defaultRGB~& is the default 32-bit RGB color that is pre-selected
Description
- title$ accepts an empty string ("") in which case system defaults are used
- The dialog box automatically becomes a modal window if the application window is visible
- defaultRGB~& may be ignored on some platforms
Availability
- QB64-PE v3.4.0 and up
Examples
- Example
- Color selection
mycolor~& = _COLORCHOOSERDIALOG("Select a color", _RGB32(0, 255, 255)) IF mycolor~& <> 0 THEN _MESSAGEBOX "Information", "You selected " + HEX$(mycolor~&) |
See also
- _NOTIFYPOPUP
- _MESSAGEBOX
- _MESSAGEBOX (function)
- _INPUTBOX$
- _SELECTFOLDERDIALOG$
- _OPENFILEDIALOG$
- _SAVEFILEDIALOG$