COLORCHOOSERDIALOG: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Initial version)
 
(Change signed longs to unsigned longs for 32bpp colors)
Line 3: Line 3:


{{PageSyntax}}
{{PageSyntax}}
:{{Parameter|color32bpp&}} = [[_COLORCHOOSERDIALOG]]({{Parameter|title$}}[, {{Parameter|defaultRGB&}}])
:{{Parameter|color32bpp~&}} = [[_COLORCHOOSERDIALOG]]({{Parameter|title$}}[, {{Parameter|defaultRGB~&}}])




{{PageParameters}}
{{PageParameters}}
* {{Parameter|title$}} is the dialog box title
* {{Parameter|title$}} is the dialog box title
* {{Parameter|defaultRGB&}} is the default 32-bit RGB color that is pre-selected
* {{Parameter|defaultRGB~&}} is the default 32-bit RGB color that is pre-selected




Line 14: Line 14:
* {{Parameter|title$}} accepts an empty string ('''""''') in which case system defaults are used
* {{Parameter|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
* The dialog box automatically becomes a modal window if the application window is visible
* {{Parameter|defaultRGB&}} may be ignored on some platforms
* {{Parameter|defaultRGB~&}} may be ignored on some platforms




Line 24: Line 24:
; Example : Folder selection
; Example : Folder selection
{{CodeStart}}
{{CodeStart}}
mycolor& = {{Cl|_COLORCHOOSERDIALOG}}("Select a color", {{Cl|_RGB32}}(0, 255, 255))
mycolor~& = {{Cl|_COLORCHOOSERDIALOG}}("Select a color", {{Cl|_RGB32}}(0, 255, 255))
{{Cl|IF}} mycolor& <> 0 {{Cl|THEN}} {{Cl|_MESSAGEBOX}} "Information", "You selected " + {{Cl|HEX$}}(mycolor&)
{{Cl|IF}} mycolor~& <> 0 {{Cl|THEN}} {{Cl|_MESSAGEBOX}} "Information", "You selected " + {{Cl|HEX$}}(mycolor~&)
{{CodeEnd}}
{{CodeEnd}}



Revision as of 23:08, 29 October 2022

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 and up


Examples

Example
Folder selection
mycolor~& = _COLORCHOOSERDIALOG("Select a color", _RGB32(0, 255, 255))
IF mycolor~& <> 0 THEN _MESSAGEBOX "Information", "You selected " + HEX$(mycolor~&)


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link