From the Manual: “On macOS, if the Color Picker was left open when the user quit your app, it will be automatically closed upon relaunch.”
Whatever I do, the ColorPicker shows up at launch of the app? Basically the opposite of what the manual says (sort of). Also the Prompt, Top, Left, Width, Height attributes in the ColorPicker.Show command are ignored. Anyone?
What I want: the ColorPicker only shows whenever the code uses the show method.
App.Open
#if TargetMacOS
if NSColorPanelMBS.SharedColorPanelExists then
cpOSX = new MyNSColorPanelMBS(nil) // cpOSX is a global variable
cpOSX.hide
end if
#endif
Calling the shared close method doesn’t help if certain things get stuck. I had this same problem, and had to delete the “com.[me].myapp.savedState” folder in “~/Library/Saved Application State” to fix it (renaming my app also fixed it, but switching the app name back brought the problem back). I’m not sure why it got stuck, and haven’t been able to duplicate it. I discussed it here.
Thank you, Rick.
I could not find DesktopColorPicker or ColorPicker in the Online Reference of v2.1; but DesktopColorPicker is available in Online Reference v3.1.
On the other end, in v2.1, in a project, typing “desktopcol” autosuggests desktopColorPicker.
Yes, I get it.
I got baffled since in Language Reference (built-in), typing ColorPicker (and later DesktopColorPicker) did not show anything. I was left with the old “color” entry-description.
Only after switching to v3.1 I could see its description containing “Close” and the sentence quoted by the original poster.
Interesting thread. I’m working on an iPad drawing app. I have a few changes for a Catalyst app. I tried once to use the UIColorPickerViewController class. I didn’t like it, mainly because it’s limited to RGB. I coded my own hue, sat, lightness picker. I removed all references to UIColorPickerViewController, but the picker is still launched every time I build the app. How can I divorce my app from this picker?
The system remembers the visibility based on the bundle identifier of your app, so if not explicitly closed, it will keep appearing when the app next launches.
I explicitly closed it multiple times, and each time I got an error message in the debug window in Xcode. I didn’t save the messages. It finally stayed closed starting about 15 minutes after my post here.