Hi,
I’m using the code below to open the OS’s color pipette window:
call selectColor(c, "")
Does anyone know how to determine if the “Cancel” button was pressed in that window?
Any code I write below this - gets executed if the user selects a color OR if the user cancels
Thank you all in advance.
[quote=191363:@Richard Summers]Hi,
I’m using the code below to open the OS’s color pipette window:
call selectColor(c, "")
Does anyone know how to determine if the “Cancel” button was pressed in that window?
Any code I write below this - gets executed if the user selects a color OR if the user cancels
Thank you all in advance.[/quote]
In the example from the LR, b is False if the user cancels. Here is a solution taken from the LR example :
Dim c as Color
Dim b as Boolean
c=CMY(.35,.9,.6) //choose the default color shown in color picker
b=SelectColor(c,"Select a Color")
if b then Rectangle1.FillColor=c
Ahh, I presumed that it would not be in the LR, as the OS’s color pipette window is not part of Xojo.
Thanks Michel - much appreciated.
you can use NSColorPanelMBS class in MBS Plugin to run the panel asynchronously.
That allows you to close it by code.