ColorPicker keeps popping up at App launch

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.

Environment ? (Big Sur | Monterey, Xojo 2021r3.1 ?)

If you use MBS, add this to App.Open:

App.Open
#if TargetMacOS
if NSColorPanelMBS.SharedColorPanelExists then
  cpOSX = new MyNSColorPanelMBS(nil) // cpOSX is a global variable
  cpOSX.hide
end if
#endif

Make sure you call the shared Close method on app quit.

1 Like

Thanks for the suggestion. However this does not change the issue.
The issue is gone after having build the app, for some reason.

Monterey, Xojo 2021r3.1

Thanks for the suggestion. Using MBS feels like AutoPilot and I like doing the steering… :slight_smile:

This is expected behavior of the Apple color picker.

If you want it to be closed on app launch, I’d recommend following @Greg_O_Lone advice.

I would also recommend you a file a Feedback case asking for the documentation to be updated.

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.

1 Like

How would I do that? Thanks.

1 Like

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.

If you dragged a color picker to the project, you could see its Class.


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.

But but but… the desktop controls were supposed to eliminate confusion and not make new confusion.

1 Like

How do you call them in code ?

ColorPicker or DesktoipColorPicker ?.

DesktopColorPicker (and DesktopColorPicker.close) autocomplete also in v2.1

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.

1 Like

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.