Re: NSColorPanel and close box
Re: NSColorPanel and close box
- Subject: Re: NSColorPanel and close box
- From: Matthias Schmidt <email@hidden>
- Date: Wed, 30 Sep 2015 16:12:51 +0900
> Am 30.09.2015 um 15:43 schrieb Jens Alfke <email@hidden>:
>
>
>> On Sep 29, 2015, at 11:31 PM, Matthias Schmidt <email@hidden> wrote:
>>
>> the host app is 4D, which is about moving to 64bit.
>
> Oh my god, the database 4D? I had no idea that still existed. The company I worked for in the ‚80s used to use it.
yes it does and it finally abandons the Carbon code inside :-)
Years ago I wrote a plugin in Carbon, which still works, but now 4D is moving to 64bit, which requires rewriting the plugin in Cocoa.
4D still has a good user base and it grew, the server can now serve more than 1000 users - depending on the hardware of course ;-)
>
>> I thought modal runloop mode is the default for panels or do I need to set NSModalPanelRunLoopMode somewhere else in my code?
>
> No, you don’t want a modal runloop mode unless you have a modal window like an alert. I just thought of it because it will act much like what you’re saying — you can’t interact in most ways with windows that aren’t the main window. You’re not calling any of the NSRunloop -runXXX methods, are you?
>
no, I don’t.
I just call this code here:
MyPicker *meinPicker = [[MyPicker alloc] init];
switch (mode) {
case kFD_4DMode: // para 2 = 4D Farbe, Para 3 = Alpha Value
[meinPicker setMyColorWith4D:col_a withColB:col_b];
break;
case kFD_RGB: // needs 5 parameters R-G-B-Alfa
[meinPicker setMyColorWithRGB:col_a withColB:col_b withColC:col_c withColD:col_d];
break;
case kFD_HSV: // needs 5 parameters H-S-B-Alfa
[meinPicker setMyColorWithHSV:col_a withColB:col_b withColC:col_c withColD:col_d];
break;
case kFD_CMYK: // needs 6 parameters C-M-Y-K-Alfa
[meinPicker setMyColorWithCMYK:col_a withColB:col_b withColC:col_c withColD:col_d withColE:col_e];
break;
case kFD_Gray: // needs 3 Parameters
[meinPicker setMyColorWithGrey:col_a withColB:col_b];
break;
}
[meinPicker setPicker:meinPicker];
while ([NSColorPanel sharedColorPanelExists]) {
PA_Yield();
}
// collecting data and return it to 4D
then setPicker looks like that:
-(void)setPicker:(id)sender {
panel = [ NSColorPanel sharedColorPanel ];
[ panel setColor: myColor ];
[ panel setMode: (NSColorPanelMode)pMode ];
[ panel setContinuous: YES ];
[ panel setTarget: self ];
[ panel setAction: @selector(changeColor:) ];
[ panel setDelegate: sender];
[panel worksWhenModal]; // this makes no difference
[ panel makeKeyAndOrderFront: self ];
}
when windowWillClose gets fired I remove the observer, close the window and release it.
It all works as expected besides the dump closing box and this drives me nuts currently, as I couldn’t find a solution on the net yet.
cheers
Matthias
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden