NSColorWell is not showing colour panel when unchecked Bordered option inside attribute inspector?

StackOverflow https://stackoverflow.com/questions/22452310

  •  15-06-2023
  •  | 
  •  

Why NSColorWell is not showing colour panel when unchecked Bordered option. I have tried with checked bordered, its working fine showing color panel as well. But when unchecked Bordered, not displaying any colour panel. Also i have connected IBaction method to colourwell also. But it is also not responding. Is there any way to make NSColorWell work without checking Bordered option??

or else, Is this the bug??

有帮助吗?

解决方案

The feature you are asking is not supported.

You can achieve it by doing some tweak. Here is how you can do.

Create a transparent gradient button similar sized to the colorwell and arrange them as shown in this pic.

enter image description here

Then write an action for the button itself. User will feel that he is clicking on the colorwell.

- (IBAction)showColor:(id)sender {

    [[NSApplication sharedApplication] orderFrontColorPanel:nil];

}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top