Re: NSColorPanel and close box
> Am 01.10.2015 um 18:30 schrieb Matthias Schmidt: > > >> Am 30.09.2015 um 17:09 schrieb Matthias Schmidt : >> >> >>> Am 30.09.2015 um 16:11 schrieb Jens Alfke : >>> >>> >>> On Sep 30, 2015, at 12:04 AM, Matthias Schmidt wrote: while ([NSColorPanel sharedColorPanelExists]) { PA_Yield(); } >>> >>> Yikes! That looks very suspicious. You shouldn't be running loops like that >>> in a Cocoa app. AppKit is event driven, so you handle a single event and >>> return. >> so that’s not the reason. If I just open the panel and leave the 4D code, the panel behaves the same. Is there a way I could catch it, when the User is clicking in the closeBox - it actually becomes dark, is just not doing anything? thanks Matthias ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel and close box
> Am 30.09.2015 um 17:09 schrieb Matthias Schmidt: > > >> Am 30.09.2015 um 16:11 schrieb Jens Alfke : >> >> >> >>> On Sep 30, 2015, at 12:04 AM, Matthias Schmidt wrote: >>> >>> while ([NSColorPanel sharedColorPanelExists]) { >>> PA_Yield(); >>> } >> >> Yikes! That looks very suspicious. You shouldn't be running loops like that >> in a Cocoa app. AppKit is event driven, so you handle a single event and >> return. > > there is PA_RunInMainProcess((PA_RunInMainProcessProcPtr)… which would run > the panel as modal dialog, that would be one possible approach I guess. > So I need to redesign my code and open the panel like this: > NSInteger result = [ panel runModal ]; it looks like this approach is not working with NSColorPanel it just makes buummm … so I need to go back to the original approach and find a way how to make these buttons work … cheers Matthias > > Another would be to split the tasks, like open panel and get panel values and > close the thing, which would require to return a reference to the panel to 4D. > > I have to think about that. > > >> >> It sounds like PA_Yield is running the run loop modally, which would explain >> why the color panel won't work. If that’s the way their plugin API works, >> it's got some problems. > > > it just keeps the current 4D process away from doing anything. > >> >> (Also, why did you take this off-list? Now no one else can comment.) > (you replied directly to me and I just hit reply ;-) > > Matthias > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/beta%40admilon.net > > This email sent to b...@admilon.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel and close box
> Am 30.09.2015 um 15:43 schrieb Jens Alfke: > > >> On Sep 29, 2015, at 11:31 PM, Matthias Schmidt 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel and close box
> Am 30.09.2015 um 16:11 schrieb Jens Alfke: > > > >> On Sep 30, 2015, at 12:04 AM, Matthias Schmidt wrote: >> >> while ([NSColorPanel sharedColorPanelExists]) { >> PA_Yield(); >> } > > Yikes! That looks very suspicious. You shouldn't be running loops like that > in a Cocoa app. AppKit is event driven, so you handle a single event and > return. there is PA_RunInMainProcess((PA_RunInMainProcessProcPtr)… which would run the panel as modal dialog, that would be one possible approach I guess. So I need to redesign my code and open the panel like this: NSInteger result = [ panel runModal ]; Another would be to split the tasks, like open panel and get panel values and close the thing, which would require to return a reference to the panel to 4D. I have to think about that. > > It sounds like PA_Yield is running the run loop modally, which would explain > why the color panel won't work. If that’s the way their plugin API works, > it's got some problems. it just keeps the current 4D process away from doing anything. > > (Also, why did you take this off-list? Now no one else can comment.) (you replied directly to me and I just hit reply ;-) Matthias ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSColorPanel and close box
Hello, it’s been a while :-) I started to rewrite a Plugin from Carbon to Cocoa and I have some trouble with the NSColorPane. The colorPane opens, I can choose any color, change the mode etc, but I can close it only with the ESC key. None of the boxes in the title bar react on a click. Neither the close box (that’s the one I need) nor the resize box. A double click in the title bar is resizing the box. So to see what’s going on I did this: [ panel setDelegate: sender]; and then: -(BOOL)respondsToSelector:(SEL)aSelector { NSString *methodName = NSStringFromSelector(aSelector); NSLog(@"antwortet auf Selector: %@", methodName); return [super respondsToSelector:aSelector]; } and I get all kind of responses, but none, when I click on one of the buttons in the title bar. I also tried this: NSButton *closeButton = [[ NSColorPanel sharedColorPanel] standardWindowButton:NSWindowCloseButton]; [closeButton setTarget:self]; [closeButton setAction:@selector(closePanel:)]; but it doesn’t do anything :( When I press the ESC-key the close buttons nevertheless blinks shortly and then windowWillClose gets fired. I believe I miss something here … thanks for any hint Matthias ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel and close box
What’s the host app? It sounds like something’s going wrong with event dispatching. Or, you’re not using a modal runloop mode, are you? —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com