Re: NSView/NSTableView question
Great thanks for the replies. I was also thinking about this but I might try to add a little bit of graphics too using NSBezierPath would it still work? But at least these 2 ideas can keep me going until I get this working right. Thanks! You can also do this in a subclass of NSTableView: - (void)drawRect:(NSRect)rect { [super drawRect:rect]; if([self numberOfRows] 0) { return; } // draw empty message here } It’s worth noting that overriding -drawRect: disables certain performance optimizations implemented by the table view. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ImageAndTextCell still the way to go for icons in outline views?
The old ImageAndTextCell doesn’t handle the background style, and that alone makes a modified version of the ATImageTextCell worth using. What do you mean by 'the background style'? I don't need the cell to draw a background at all; it's in an outline view. Take a look at the backgroundStyle property, new in 10.5. It makes drawing the right colors and background for a given view state much less error-prone. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Question about touchesBegan
I'll elaborate a little more. I have a main view with some source buttons (UIButton) at the top. When I click one, I bring up a radio style tuner bar in a subview (animates up from the bottom). I am using touches to move the pointer in that subView. Works great, however because the subView is detecting touches for the whole subView - it prevents touches on those buttons in the main view. Do I simply need to architect this in another way? Say create a subview of just the UIButtons at the top of all subViews? That would work. You could also override -hitTest:withEvent:. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ImageAndTextCell still the way to go for icons in outline views?
I looked at ATImageTextCell, but it does things I don't need (fill color) and has dependencies on a bunch of other classes from that sample. I'll stick with ImageAndTextCell since it's simpler and standalone. The old ImageAndTextCell doesn’t handle the background style, and that alone makes a modified version of the ATImageTextCell worth using. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
Erm, Ustream Live Broadcaster does it just fine. Are you suggesting they are circumventing API restrictions? http://www.techcrunch.com/2009/12/09/iphone-live-streaming-ustream/ There was recently a clarification in the developer forums from Michael Jurewitz; I’d suggest you take a look there. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with setMarkedText:selectedRange:
Hi, I have a view which implements the NSTextInputClient protocol, and my implementation of - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange creates an NSTextView, adds it as a subview, makes it first responder, selects all the text, deletes it, and then tries to use either the same setMarkedText... call on the subview's input context or setMarkedText:selectedRange: on the view to try to set the marked text. It looks as if it works, but when I press the next keystroke, it doesn't insert the composed character. E.g. I want to add an e acute, and I press option-e and it shows the acute, then I press e and it just replaces the acute with the e instead of composing an e acute. Any suggestions of how to get this working properly? This discussion belongs on cocoa-dev; coretext-dev is a discussion list for the CoreText API. That being said: your input client’s NSTextView subview has its own editing session, so the input method won’t try to compose text (that is, setMarkedRange: is an appearance attribute only and doesn’t affect how the system interprets user input). Why are you inserting a subview like this? If it’s just to get the yellow-highlight/thick-underline behavior, you should implement that yourself in your input client. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Instruments UI Recorder and Screenshots
I've been playing around with the UI Recorder functionality in Instruments and I'm interested in taking a screenshot after a UI Recorder playback has occurred. Does anyone know if this is possible? It looks like you can create your own instruments which can run scripts, so I thought it might be possible to use the screencapture command to pull this off, but I'm not sure if its possible to target a specific window (iPhone Simulator) and if I can get this to occur after the UI recorder playback has completed. You can script Instruments using the instruments(1) CLI tool; I’m not sure if you can save your recorded trace as part of a template, but if you can, that might get you there. That said, the xcode-users list is more appropriate for this question. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Right-to-Left / Bidi / Arabic / Hebrew support in my app
It looks like I'll just have to use other controls to do the same effect in IB, and just check of locale.name == ar || he in code to do the reverse drawing. On 10.6 your heuristic should instead mirror the value of the new -userInterfaceLayoutDirection accessor in NSApplication (and NSCell). From the release notes: NSApplication -userInterfaceLayoutDirection is a new NSApplication interface that returns the default layout directionality of general user interface flow for the running application. The method returns NSUserInterfaceLayoutDirectionRightToLeft when running with localizations such as Arabic or Hebrew that should have the user interface layout origin on the right edge of the coordinate system. NSCell (Updated since WWDC 2008) NSCell now has -userInterfaceLayoutDirection and -setUserInterfaceLayoutDirection:. This new property describes the in-cell layout directionality. For NSCell subclasses that have multiple visual components in a single cell instance, this property should specify the directionality or flow of components. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSplitView resizing
I have a window containing a NSSplitView. When the window is resized, both panes of the split view resize proportionally. I would like one pane to remain fixed while the other resizes. Xcode does this, as well as iCal and other apps. Is there a delegate method that does this or must I subclass NSSplitView? You can achieve this with the -splitView:resizeSubviewsWithOldSize: delegate method. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Title Bar of Key Window
I was just wondering if it was possible to control this behavior and not have the title bar highlighted for a particular window, but still allow it to be the key window. The particular kind of window I am interested in is a NSPanel. Is it an inspector-type window? You may want to make it non-activating. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I track down an OSStatus error code?
Looking for the meaning behind the value -43. Try MacErrors.h in CarbonCore. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSCondition (unlocked when not locked)
What’s the value of SLEEP? -waitUntilDate: can return NO indicating that the timeout elapsed and the lock is not locked; you probably want -wait. No, I do want the waitUntilDate because I do not solely want to wait for the signal. In that case you probably want to use an NSConditionLock with all the conditions you would like to wake up for; better than polling for whatever else you’re doing except in the very specific case of a task which actually needs to be performed at a given interval (though the way the code is structured right now may end up running your other tasks more often than SLEEP). So you are saying it should rather be like this? while (!quit) { [pollingCondition lock]; if([pollingCondition waitUntilDate: [NSDate dateWithTimeIntervalSinceNow:SLEEP]]) { [pollingCondition unlock]; } ... } I can't seem to find that indicated in the documentation though. http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/NSCondition_class/Reference/Reference.html Also the documentation suggests that after calling [pollingCondition lock]; the contract is to have a lock for sure. You know, you’re right. I was thinking of the way that NSConditionLock behaves here (do you see a pattern?). Sorry for the bad advice—how embarrassing. Greg Guerin’s advice is helpful, and is yet another thing shoving you toward NSConditionLock (it manages the boolean—or higher-cardinality—condition). It doesn’t explain why the lock was complaining about being unlocked; did you try breaking on _NSLockError like the log message suggests? Are you perhaps reinitializing the pollingCondition from another thread? -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Font matching
Hi, I have an application where I need to be able to find the closest equivalent font should a font be missing. e.g. someone creates a file and sends it to someone else, who doesn't have the font that was used to create the original file installed on their system. I thought that maybe saving the NSFontDescriptor in the file should be able to allow me to find the best font using the matchingFontDescriptorsWithMandatoryKeys method passing nil as the mandatory keys That’s pretty much exactly the intention of the descriptor. Since NSFontDescriptor is toll-free bridged, you’ll find that many of these questions are answered in the CTFontDescriptor documentation. I have no idea what it would do if the font was either there or missing: - if the font was there, would it return just one font descriptor, or potentially multiple? If descriptor itself is normalized, then the array will contain only one item: the original descriptor. In the context of font descriptors, normalized infers that the input values were matched up with actual existing fonts, and the descriptors for those existing fonts are the returned normalized descriptors. - if it was able to be exactly matched, is there some way of knowing this (e.g. is isEqual: implemented on NSFontDescriptor?) You can compare the -fontAttributes dictionaries. - if the font is not there, will it continue to fall back until it finds a suitable font? If so, will it return only one item in the array? What does it try to match in the algorithm? It will fall back to the system font, yes. If there are mandatory keys there may not be any matching font. The algorithm tries to match as many keys as it can when finding a suitable font. - if it does return multiple descriptors, are they ordered so that I know which one is considered the best match? There is an ordering, but it's not likely to help you. The -fontAttributes dictionary will come in handy for sorting by relevance. - if I pass in nil as the mandatory keys, will it *always* return at least one descriptor? Yes. Now sometimes my file is edited by someone using windoze, and the font name doesn't exactly match what you see on the Mac even though it is essentially the same font and usually the name of one is a substring of the other. Is there an elegant way to handle this? If the name isn’t a mandatory key you can try a binary search of the result list (sorted by name) and use a heuristic of your choosing to decide whether the font matches. You may want to instantiate a font for the descriptor and compare the display and family names as well as the standard (PostScript) name. If you have more questions you’re best off heading to the coretext-dev list, where the ATS and CoreText engineers are more likely to hang out. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MDSchemaCopyAllAttributes() returning nil
I'm working on a project that works a lot with Spotlight, and we're trying to get a list of all the attributes that Spotlight knows about. We found a really nice function called MDSchemaCopyAllAttributes that returns a CFArrayRef of CFStringRefs, each one corresponding to a spotlight attribute in the schema. The problem is that when we run this program as root (which we have to), MDSchemaCopyAllAttributes seems to consistently be returning nil. Is this normal behavior? If so, how can we get a list of all Spotlight attributes across an entire machine (and not just the user domain)? You should be using a privileged helper process for the privileged operations your application performs instead of running as root. There was a great session on Authorization Services at WWDC; until the video is up, you can take a look at: • The Authorization Services Programming Guide: http://developer.apple.com/documentation/security/conceptual/authorization_concepts/01introduction/introduction.html • BetterAuthorizationSample: http://developer.apple.com/samplecode/BetterAuthorizationSample/index.html#//apple_ref/doc/uid/DTS10004207 -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MDSchemaCopyAllAttributes() returning nil
Why is the privileged process asking Spotlight for anything? Try to factor as much code as possible out of your privileged tool. This is the root tool that powers the Mozy backup product. One of the features is that users can specify queries to determine which files to back up. However, it needs to find all files across the system, and not just the users files. Hence, our backup utility has to run as root. Part of our query stuff needs to have access to the list of spotlight attributes for optimization reasons. You can pass it in from the UI process, then. Like Kyle was alluding to, the tool should do as little as possible with privilege. If all you really need privileges for is file enumeration and copying, then that’s all you should do. You can use IPC to filter in the main process with the full complement of libraries available to you. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: issues encoding MailMessage and NSData
that works fine, but when I go to decode the object I get the following error: exception raised:*** -decodeObjectForKey: only defined for abstract class. Define -[NSKeyedArchiver decodeObjectForKey:]! You need to use an NSKeyedUnarchiver, not an NSKeyedArchiver, to decode the object. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Capturing key events in a menu
When a menu is open the Menu Manager in HIToolbox handles incoming events on its own. You be able to capture the events with an embedded NSView, but I first need to ask the standard question: what are you trying to achieve? Well, I want to know what the user typed when a menu is open, so that I can narrow the items displayed. Something like the Spotlight for Help implementation, then? (That's the search field in the Help menu in most apps in Leopard.) How can I embed an NSView? I know I can do that for an NSMenuItem, but then the menu item must have focus for the view to receive the events, is it not so? The thing to do would be to embed an NSSearchField in an NSMenuItem, and have it receive focus when the menu is opened. As for filtering the results, you'll need to replace the menu content with your own filtered content, which is extremely tricky to do with the current Menu Manager API. I’d suggest that you: 1) File a bug asking for API to simplify the implementation of this sort of menu, 2) file a bug asking for a sample app that shows how to implement this sort of menu, 3) think of another UI to use in the meantime. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Capturing key events in a menu
Basically, I want to do quite a simple thing: capture a keyDown event when a menu is opened. So the user opens a menu, presses a key and I want to know what key it was. Unfortunately NSMenu isn't an NSResponder, so I can't capture it there. Also, the event isn't passed down to NSApp (where I could capture it in a subclass or delegate), as the menu handles it to position the higlight on the appropriate letter. Can I somehow override that behaviour? When a menu is open the Menu Manager in HIToolbox handles incoming events on its own. You be able to capture the events with an embedded NSView, but I first need to ask the standard question: waht are you trying to achieve? -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interpreting -underlinePosition and -underlineThickness
How should NSFont's -underlinePosition and -underlineThickness values be interpreted? Are they fixed values, indicating an absolute offset, or are they some proportion of the pointSize or something else? In the optimal case (I’ll explain shortly), the underlinePosition is the number of points below the baseline to position the center of the line with width underlineThickness. However (and this is a big however), many fonts report an invalid underline thickness and/or position. In this case, both the Cocoa and CoreText rendering paths cook up values based on the average of the metrics of Helvetica and Times, scaled to fit the metrics of the selected font. (Please do file a bug for API to access these computed values.) I ask because the results I'm getting by treating it as an absolute value differ from Apple's rendition, but the docs are unenlightening on this point. An image with a comparison would go a long way to helping us diagnose this issue. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Breaking underlining on descenders
When standard text lays out with underlining, the underline is interrupted around descenders, which is nice. Unfortunately my underlining code doesn't do this, and I can't see a simple way or layout manager delegate method I could use to figure out where the breaks should go. Is there somewhere else I should be looking, or is there no public method to help here? If the latter, any ideas on how I could figure out the break positions? All I need is a list of offsets relative to the line fragment rect where the breaks are. You can draw the underline first, then a large point-width stroke in NSClearColor in copy compositing mode (or alternatively, the wide stroke fill used as a negative mask), then the actual fill on top. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Centering a window ... not in the usual way!
I am not sure of Mic's intent, but [window center] is only useful for the main screen. If you need per-screen windows, I am not sure how to have the OS do it. Given a few different resolutions though, it should not be hard to deduce the OS positioning algorithm. For what it's worth: the center algorithm currently places the center of the window 3/4 of the way up from the bottom of the main screen's frame, and then makes any adjustments necessary to keep the window title on the screen. This definition may very well change in a future release, but is true as of Mac OS X 10.5. Please do file a bug if you'd like to see API and/or better documentation for determining the proper attention position for a window. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings related NSUndoManager problem
Now I have come to implement Undo. It actually works, but there is a problem (see below). The code to implement Undo is in my view class: - (void)removePath:(PathElement *)oldPath { NSUndoManager *undo = [[self window] undoManager]; [undo registerUndoWithTarget:self selector:@selector(addPath:) object:oldPath]; [undo setActionName:@Remove Object]; [paths removeObject:oldPath]; [self setNeedsDisplay:YES]; } - (void)addPath:(PathElement *)newPath { NSUndoManager *undo = [[self window] undoManager]; [undo registerUndoWithTarget:self selector:@selector(removePath:) object:newPath]; [undo setActionName:@Add Object]; [paths addObject:newPath]; [self setNeedsDisplay:YES]; } You're not sending KVO change notifications for the paths key, so the observer isn't tearing down its observations when the path is removed. See the NSKeyValueObserving Protocol Reference: http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/willChange:valuesAtIndexes:forKey: -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CA -animator animation only works the first time
On Tue, Apr 28, 2009 at 02:49:23PM -0700, Erg Consultant wrote: I have two standard Cocoa objects in my window that I animate using CA's AppKit -animator method. When my nib loads, I get the original NSRects of the two items by sending them the -frame message. I then recalc the rects to move the two views offscreen. When I show my window, I animate both views back into the window thusly: [ [ oudWindowIconView animator ] setFrame:destGameIconRect ]; [ [ oudWinowLogoImage animator ] setFrame:destLogoRect ]; This works fine - the first time. The next time I show my window and the same code runs, the two items are not visible in the window. The dest rects of the reanimated views are the same as the original view rects when the nib loads. So why does the animation work only the first time? -awakeFromNib will only be called once, when the window is loaded from the NIB. You need to reset the view positions in the code that actually displays the window. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSLocalizedStringFromTableInBundle Questions
If I do a NSBundle *thisBundle = [NSBundle bundleForClass:[self class]]; it won't compile. That code should work. Can you be more specific about the error? E.g. your exact code and compiler error logs. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically opened NSPanel not responding to actions
I am adding the NSPanel with the addWindowsItem, and display it consequently with a deminiaturize call. You should instead just orderFront: the window or showWindow:, depending on whether you have an NSWindowController. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Strange NSCell subclass issue ...
On Tue, Mar 31, 2009 at 07:37:03PM +0100, Mic Pringle wrote: Hi, I have subclassed NSCell and implemented only the following method ... - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { NSImage *separator = [NSImage imageNamed:@Separator.png]; [separator setScalesWhenResized:YES]; [separator setFlipped:YES]; NSGraphicsContext *context = [NSGraphicsContext currentContext]; [context saveGraphicsState]; NSImageInterpolation interpolation = [context imageInterpolation]; [context setImageInterpolation:NSImageInterpolationHigh]; [separator setSize:NSMakeSize(cellFrame.size.width, 2.0f)]; [separator drawInRect:NSMakeRect(cellFrame.origin.x, cellFrame.size.height - 10.0f, cellFrame.size.width, 2.0f) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f]; [context setImageInterpolation:interpolation]; [context restoreGraphicsState]; } I have then subclassed NSTableView and set the dataCell of the first column to the above subclass. All works fine, except for the fact that the image drawn (separator) in the drawWithFrame method is only drawn in the very first cell. I have three rows displayed in the table view, and can clarify this as I can click on them and get the blue highlight. Any ideas as to why this would only draw the first cell and not all three ? Your y coordinate is based off of the height instead of the top; see NSMin/NSMaxY. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
I'm running the code below. I have a single NSWindow with a checkbox and a button. In the awakeFromNib method of the main controller, I change the attribute of the checkbox string. In the compute: method, I compute the height requested to display a string for a specific font and maximum width. If I run this code as is, I get 17.0 as the required height. That's incorrect. If I comment the awakeFromNib code, I get 34.0f as the required height. That's correct. Is this the code exactly as it is in the app? e.g. compute: doesn't depend in any way on the values you set in -awakeFromNib? (I think this is your complaint, but I'm just verifying.) Not that this fixes your problem, but -[NSAttributedString boundingRectWithSize:options:] would probably be a bit easier for you to use. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom NSCell issues
hello I'm using a custom NSCell in order to draw some elements in an NSTableView. I've created a simple tableview with 2 row. However my draws is always put on first row while the second one is empty. This my code for NSOutlineView delegate http://pastebin.com/m7f5f8a0f while this is for my NSCell http://pastebin.com/m4166a9c8. What's wrong? Your midY calculation is ignoring the origin of the cellFrame, so everything is being positioned relative to the origin. Try NSMidY(rect). -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: signal(SIGUSR2, SIG_IGN) not respected by Xcode/GDB?
I'm not completely satisfied using signals (especially since they are not dynamically allocated and I may want to use more in the future) but signals was the lowest level alternative I could think about. This code will be used _very_ frequently and I want to use the lowest possible level, mainly for performance reasons but also for ease of setup. And signals seems like a reasonable alternative considering this. A pipe is the canonical way to tickle a thread waiting select/poll/ kqueue. You can rest assured that pipes are quite performant. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: signal(SIGUSR2, SIG_IGN) not respected by Xcode/GDB?
Why can't Unix be a modern OS with dynamically allocated and named signals? :-) Signal-handling behavior is so restricted to begin with that more signals would just end up with more code making non-async-signal-safe calls. Pipes are easy to create, and can easily be passed from process to process for IPC. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: need advice on subclassing NSScrollVIew
In a similar situation, I didn't subclass NSScrollView. I subclassed NSView and inserted an NSScroller directly as its subview. I tracked the position with a 64-bit variable which I converted to a range suitable for the NSScroller just for setting its thumb position and size. I set my view as the NSScroller's target to convert back to my 64-bit position. In the subclass' -drawRect: method, I calculated the visible portion of the view, and simply drew that - no NSClipView required. For your case, you'd have an additional step involving the scale; be careful with loss of precision there. Despite being somewhat more work to implement, this proved to be more efficient and also a good learning experience regarding the view drawing mechanism. One unfortunate caveat of this solution is that it’s very difficult to exactly reproduce some of the behavior of NSScrollView, especially if you plan to handle dragging or anything else that requires -autoscroll:ing. And don’t forget about exposing the proper accessibility roles and attributes. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSGradient draws incorrectly in PDF context?
I've noticed I'm getting different results with NSGradient when drawing to screen and when drawing in a PDF context, e.g. printing, or write PDF to clipboard. If the gradient contains colours with transparency, it draws correctly on-screen (allowing what's drawn behind to come through), but draws opaquely in PDF. PDF doesn’t support alpha in gradient colors. You’ll need to render out to a bitmap and then draw that instead. For best results you want a high resolution image that is dithered to prevent banding that the PDF rendering engine might otherwise do on its own. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: problems with NSTextField destroying background
My problem is, I want the NSTextField to be transparent (and show the NSBox behind), but instead it's making a hole in the NSBox to show the desktop, what am I missing? For historical reasons the NSTextField fills its content with NSRectFill, which uses the NSCompositeCopy compositing operation instead of NSCompositeSourceOver. This will blow out your window content. Please do file a Radar if you’d like to see this fixed. Can you show us a picture of what your UI looks like? We may be able to suggest an alternate solution. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MVC, storing VIEW-specific information and core data
While I do realize that I will have to get this data into the Managed Context somehow in order for it to be stored automatically with the document, I want to be able to make my model completely and utterly UI independent. You could have a NodeViewState, joined to the Node by a relationship, for each node to store the view-only parameters. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [Q] NSObject's poseAsClass - Replacement?
I have a need to use poseAsClass, but I see that it has been deprecated in 10.5 and won't be available for 64-bit applications. So, is there a replacement? WAYTTD: What are you trying to do? Maybe you don’t need to pose. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSplitView splitViewDidResizeSubviews
Also, if I want to know when the user has completed the divider movement, how would I find that out? I suspect I'd need to subclass NSSplitView method that handles the mouse events... Yes; specifically, you should look at -mouseDown:, since NSSplitView runs an event loop instead of using -mouseDown:/-mouseDragged:/-mouseUp:. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Advice on building a complex user custom control
I'm working on a small game engine, and as such, I want to create a level editor for the game. I love the old style Doom level editors, so that's what I'm going for [1]. Notice in that screenshot the amount the user can interact with - moving vertices on the grid, creating lines between vertices, adding/removing objects, etc. At the moment, I have a main MapView control, which creates vertices in an NSArrayController. I have 2 ways of viewing these vertices - one is to handle rendering them directly in the MapView, and another approach creates a new VertexView for each vertex, and adds it as a subview of the MapView. From what I've read online, this is not going to scale beyond maybe 50 vertices, so I don't think this is an approach. However, handling *everything* in the MapView itself feels like it drastically reduces the cohesion of the control. You can handle everything in one view while still breaking up the handling. For instance, you can have Vertex objects which handle events, passed to them by the MapView, when they are selected. Having one view doesn’t require you to handle all the input in one place—your view just becomes a dispatcher. My 2¢. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is there any Objective C supported code review tool?
Please name me code review tool (Freeware preferred) that is commonly used by Mac/ObjectiveC/XCode developer community. Review Boards supports any code, and I believe supports Objective-C syntax highlighting. http://www.review-board.org/ -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -finstrument-functions and program startup
Actually, a probe of 'pidnnn:::entry' works just great (where nnn is the target process' pid.) Check out the pid provider documentation: http://docs.sun.com/app/docs/doc/817-6223/chp-pid?q=dtrace+pida=view Only for code that has such probes compiled into functions / methods. Apple has these compiled into many of the system frameworks but it doesn't add them to your own code ...which was my point. That’s not correct—the pid provider instruments every user function call in the target (well, every one that has an externally visible symbol). -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -finstrument-functions and program startup
How is this instrumentation done? I guess the text segment is modified in RAM when the pid provider is attached to the process? Yes, when a probe is enabled a small thunk is dropped in that calls out to the DTrace pieces in the kernel and logs the event. USDT probes work similarly, but insert a no-op in the instruction stream since there’s no function/callsite to thunk on. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Context Menu in NSBrowser
All NSViews show, when control-clicked, their context menu. But not the NSView subclass NSBrowser. Is this a documented feature or a bug? This is a bug in the Leopard and earlier versions of AppKit. For now, you can loop through the matrices using -matrixForColumn: and set their menus individually. You’ll also need to set the menu of their superviews, the clip views which enclose the matrices, if you wish to support context menus in the areas without row content. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: File association
Document Tyoe Name : myApplication CFBundleTypeExtensions : prp Document OS Type : Role : Editor Handler rank : Owner Then run it and saved the project. Then I double click the saved project, but it opens in TextEdit. Is there any other keys I need to set? You need to set a unique document type; won’t cut it. You need to make sure the type code does not consist only of lowercase letters, as these OSTypes are reserved for use by Apple. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDictionary key from the content of a set
I'm trying to create an NSDictionary that uses key based upon the contents of a NSSet (specifically a set of NSManagedObjectID's). I'm currently at a bit loss as to how to do it. My various attempts at a hash based solution (see below) don't appear to be working. Are you creating a map from the NSSet to something else? An NSMapTable may be more appropriate. A note on your pasted code: NSString *hashFromCharacteristicTypes = [NSString stringWithFormat: [[NSNumber numberWithInteger:hashInt] stringValue]]; NSDictionary keys can be any object that adheres to NSCopying, so you don’t need to convert the number to a string before placing it in the dictionary. (In fact, you can make the set the key, but I have a feeling you probably don’t want to copy the set.) -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Quick (?) NSCell question: getting the drawing (inner) rectangle
Perhaps this method is only intended to provide information to the system by the NSCell implementation and is not intended for the purpose I need. In which case, is there a way to achieve what I want without having to ask for the NSTableColumn width and working out what proportion of this width is used for non-'interior' furniture (if any)? -[NSTableView frameOfCellAtColumn:row:] is what you’re looking for. The frame that’s passed to the interior drawing method is really dependent on the cell subclass you’re using, but it’s based on the frame passed to -[NSCell drawWithFrame:inView:]. Now the standard question: what are you trying to do? -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AudioFileOpen Error
When I build the project I get one error on the AudioFileOpen line. This is log:_AudioFileOpen, referenced from: It sounds like you haven’t linked against the AudioToolbox framework. You can add the framework by bringing up the context menu in the Xcode group tree and selecting Add Existing Frameworks…. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: File association
I saved the project using NSArchiver with an extension say .myExtension. And also I opened the saved project by unachieved it from menu. Now I need to open the saved project when double clicking on it. How can I do this file association? See the Runtime Configuration Guidelines: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-101685 Where I need to write code for unarchiving its content ? You should read about the Cocoa document architecture: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/Documents/Documents.html -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to center a custom NSView in a NSScrollView
I've already tried with a custom NSClipView, as explained here: http://www.bergdesign.com/missing_cocoa_docs/nsclipview.html This is the standard way to do this. The question is, how can I center a custom NSView in a NSScrollView, if the visible width and/or height is greater than the fixed size of the NSScrollView? What does centering mean if the view’s size is larger than that of the scroll view? -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How font size managed without affecting the font? Please help
I use this code to change the fontsize: NSFont *font1 = [NSFont fontWithName:[pop1 titleOfSelectedItem] size:[[pop2 titleOfSelectedItem] doubleValue]]; In the second popup’s action method, you should be invoking -[NSFontManager convertFont:toSize:] to convert the fonts to the right size. (And, in the first popup, -[NSFontManager convertFont:toFace:].) http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFontManager/convertFont:toSize: -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Arggg...overrelease in table view cell, but where?
I have implemented -copyWithZone in my NSTFC subclass as such: - (id)copyWithZone:(NSZone *)zone { MyTableCell *copy = [super copyWithZone:zone]; copy.cellObject = [self.cellObject copy]; copy.gridController = [self.ViewController copy]; return copy; } NSCells use NSCopyObject to do their copies, which ends up setting the values of cellObject and gridController in your copies, but not retaining them. You need to nil them out before setting the values in your properties. This is a long-standing misbehavior of NSCell that probably won’t be changing anytime soon. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cant Load an Image into a CALayer
NSImage * image = [[NSImage alloc] initByReferencingFile:@Destroyer.png]; Your conditional statement is failing because the image can't be located; you need to pass the path to your image relative to the current working directory; see the documentation: http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/occ/instm/NSImage/initByReferencingFile: If this image is in your resources directory, you can use either [NSImage imageNamed:@Destroyer.png] or [[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForResource:@Destroyer ofType:@png]] -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: tracking down a table column...
I’m getting an “ambiguous” error in my log that I can’t readily resolve. The error is: Cocoa bindings error: Error accessing bound property of object NSTableColumn 0x196370: [NSTableColumn 0x196370 valueForUndefinedKey:]: this class is not key-value coding compliant for the key value I’d like to know to which column (in human terms) this error refers. I checked my stuff, can’t see the issue right off. Everything seems to work fine as well. If you can break in the debugger, you should be able to get the column’s identifier using po [(id)0x196370 identifier] and the column number with po [tableView columnWithIdentifier:[(id)0x196370 identifier]] -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: tracking down a table column...
OK, I gave that a shot...got nada. First, I got: No symbol id in current context. So, I took (id) out of the call. Then I got: Cannot access memory at address 0x0 I did try the call for the tableView, but got the same as id above. Did you paste the lines exactly as they were, or substitute the hexadecimal values from the running log? -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: displaying huge log files
On Sun, Nov 30, 2008 at 12:48:26AM -0800, Andrew Farmer wrote: On 29 Nov 08, at 14:23, Nick Zitzmann wrote: On Nov 29, 2008, at 5:39 AM, Mudi Dandan wrote: Is it possible to to display a memory mapped file in an NSTextView Of course. With one caveat: When creating a memory mapping (by using mmap), you have to specify the length of the region you want to map - so, if the file grows, you have to remap the file. Detecting this is up to you; kqueue may be useful in doing so. Also, if the file gets really large*, it may fail to map at all on 32-bit systems, as there's a limited amount of address space available. Unless you're absolutely sure that memory-mapping files is crucial to your application's performance, try just using standard file descriptors first. The performance difference isn't that huge, and there are a lot fewer caveats** involved. If you want an example of how this mapping is done, check out the sources for HexFiend: http://ridiculousfish.com/hexfiend/ -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Textured Window Responder Issue
When the view uses NSOpenGLView a mouse drag in the view will send events to the view. It works properly. When the view uses CAOpenGLLayer a mouse drag in the view will move the window! The mouse events are being sent to the view but are apparently being picked up and acted upon by the window as well. Presumably you have a custom view; you need to return the right value from -[NSView mouseDownCanMoveWindow]: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/mouseDownCanMoveWindow -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core Data/Bindings issue
The popup button has: Content bound to MyArrayController.arrangedObjects Content Values bound to MyArrayController.arrangedObjects.name Sometimes, and is vaguely seems to be related to changing the XIB, the labels of the cells in the popup are what I would expect from calling -description on the managed objects it's listing. The rest of the UI works as expected when it happens, but the cell content is gibberish. And as luck would have it, I haven't been able to replicate this while writing this mail. There are two usual reasons that happens: 1) The content values binding is not set up to bind to a string value of the content—in this case it looks like you’re OK—or, 2) the bound selection isn’t available in the bound content values and the pop-up falls back to something else. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Key Paths @count and mutablestrings
I've cleared out all my other code and associated problems, and I'm at the same point, key path orderReference works, but [EMAIL PROTECTED] doesn't? [Session started at 2008-11-05 20:42:25 +.] 2008-11-05 20:42:28.462 powizard[22921] [_NSFaultingMutableSet 0x165e910 addObserver:forKeyPath:options:context:] is not supported. Key path: @count It sounds like you’re trying to bind to the count of an array controller which is already fetching properties through the model key info. Take a look at this message from the archives: http://www.cocoabuilder.com/archive/message/cocoa/2006/12/1/175296 -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Q] How to add nested items to NSOutlineView?
However, if I get reference of an item in existing view and insert new item in its data source, NSMutableArray, it can't display the newly added nested items. I tried NSTreeController's rearragneObjects and the NSOutlineView's reloadItem:reloadChildren, but it doesn't seem to work for me. Can anyone tell me how to add new items? Since you’re using NSTreeController, you should modify the array in a KVO-compatible way. Take a look at http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/mutableArrayValueForKeyPath: -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Key Paths @count and mutablestrings
On Mon, Nov 03, 2008 at 06:55:24PM +, Amy Heavey wrote: PurchaseOrder is an Entity, with a relationship called products to the PurchaseOrderItems Entity which lists the actual items on the order. I'd like a column in my Purchase Order tabel to display the number of items in the order, so I've tried a number of different things along the lines of Value: bound to Purchase Order Array Controller arrangedObjects @count.products but I get the following error: 2008-11-03 18:41:44.928 powizard[8498] [NSManagedObject 0x654a70 valueForUndefinedKey:]: this class is not key value coding-compliant for the key @count. … How do I access the count of a to-many relationship? You’ve got that backwards; you want [EMAIL PROTECTED] I then want to print out some of this data, so I've created a view, and got it all laid out, now I just need to populate it with the data. I thought the easiest way would be to loop through the info and display strings but I'm struggling a bit. Do you mean print out on a printer, or just display on the screen? I figure I need 4 strings, 1 for each 'column' of the table I want, then I can just create strings with new lines and it will lay itself out correctly. If I was binding a tablecolumn I would use the following binding: arrangedObjects.qty[Purchase Order Items Array Controller (NSArrayController)] so how do I loop through the array, setting the string value each time to create a string along the lines of @1234/n3698/n3258/n4587/n where 1234, 3698, 3258 and 4587 are the qty values? I’m not really clear what you’re doing here. You’ll want to go through your array controller’s arrangedObjects accessor to get the values, and then pull out the keys on your own. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: About Ink drawing with wacom tablet
Did I miss something, or I was doing something wrong? I have InkSetApplicationWritingMode (kInkWriteAnywhereInApp); InkSetApplicationRecognitionMode (kInkRecognitionGesture | kInkRecognitionText); You don’t want to turn on Ink in your case, since you want to capture the tablet events on your own instead of having Ink send them to the recognizer. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [OT] How do people use and contribute to this list?
Can anyone offer any advice or suggestions? Or should I settle for the cumbersome digest mode? I’ve found that a combination of procmail rules on my IMAP box and Mutt compiled with the ignore-thread patch [1] work quite well for me. I haven’t found a MUA which beats Mutt for reading mailing lists (and indeed that’s all I usually use it for). -Ben [1]: http://ben.at.tanjero.com/patches/ignore-thread-1.5.18.patch There are some bugs in the updated version of this patch, but it works well enough for my intended uses. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: UI elements in custom view mess up drawing
When I turn off the progress indicator however, or when I update the string value of the text field, the drawing from the drawRect method above is drawn offset from its origin, instead drawing at the origin of either of the subviews, resulting in spurious lines being drawn where there should only be background (the gradient). (You can see a screenshot of the effect here: http://sintraworks.com/private/RenderingMess.png) The rect passed to -[NSView drawRect:] is the dirty rect of the view, not the bounds of the view. The changing subviews are dirtying your view and then you're drawing as if that changed area was your complete frame. Try replacing your use of rect with -[NSView bounds] instead, and then take a look at the View Programming Guide [1]. -Ben [1]: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/chapter_1_section_1.html ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: waiting for an NSThread
I've another n00b Cocoa question: How can I wait for a thread to finish without depending on a flag that may be reset and set before the thread i'm waiting for has time to check it? Take a look at NSConditionLock in Foundation. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with loose ViewController coupling and KVO to-many relationships
There's a design flaw here somewhere, but I can't quite figure out what it is. It's highlighted by trying to reorder widgets. With KVC to-many relationships, there's no atomic way of moving an object from one position in an array to another : you remove the object, then re-insert it at the new location. But when the object is (temporarily) removed from the array, the window controller gets an observeValueForKeyPath saying it's been deleted, and so releases the corresponding WidgetViewController, the view gets deallocated, and so on. I'll then get a second observeValueForKeyPath saying that an object has been inserted, recreate the WidgetViewController, re-insert the view, etc etc. That’s not a design flaw, but rather just a shortcoming of the KVO change model. Note that NSMutableArray has no operation to move an object from one index to another, either. This seems pretty wrong to me. I can see a few workarounds (perhaps storing the kvo notifications until the end of the current runloop so I can add them together and figure out what was really a deletion and what was just a reordering), but they all seem pretty ugly and heavyweight. The runloop batching is probably the best thing to do if you’re concerned about the cost of reordering views, or if you want to animate the change in some way. If you just need to atomically rearrange the view, you might be able to get by with a pool of recently-deallocated WidgetViews and WidgetViewControllers that you reuse when you get a new object insertion (avoiding the allocation overhead). -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: IKImageView and delegate callback/notification of image changes
Has anyone come across a solution for knowing when the image has been edited? You should be able to use KVO to be notified when the image property of the IKImageView changes. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSLevelIndicator - setEnabled not respected
I've googled for over a week, and I can't find out what I'm missing here. See the AppKit release notes for 10.5 at http://developer.apple.com/releasenotes/Cocoa/AppKit.html In short, the enabled property only works if you link your app against 10.5+. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Always allowing drags from WebView inside a global NSPanel
The problem I am having is that to drag out of the WebView the panel has to be main (i.e. the close/minimize/zoom buttons are filled in). However, if you hold down the command key, the drag out of that window works fine. Where do I start looking to make this work without having to hold down the command key? Have you looked at -[NSView acceptsFirstMouse:]? -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
What I want to achieve is that when a new window is created, it has the maximal size allowed by the screen, menu and the dock, exactly like if someone clicked the green zoom button in the window's title bar. I don't want any resizing animation or flickering though. Before ordering the window onto the screen, you can set its frame to fill the screen by calling -[NSWindow zoom:]. Alternatively, you can set its frame to [[window screen] defaultFrame], which is the same frame that -zoom: will use, subtracting space for any visible drawers. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
On Sat, Sep 20, 2008 at 12:22:52PM -0700, j o a r wrote: Alternatively, you can set its frame to [[window screen] defaultFrame], which is the same frame that -zoom: will use, subtracting space for any visible drawers. I think that should be: -[NSScreen visibleFrame] Yes, that’s correct—my mistake. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core data fetch returns no objects
On Thu, Sep 18, 2008 at 02:05:03PM +0200, Tomaž Kragelj wrote: If I use the same code for fetching immediately after adding the objects to the context, the fetching works... It looks like the problem might be related to fact that I use different persistent store for Project than for Measurement - if I fetch other objects saved in the same persistent store, fetch works. Core Data does not support relationships across persistent stores. You may be able to use fetched properties to grab the related objects. See the Core Data programming guide: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdRelationships.html#//apple_ref/doc/uid/TP40001857-SW5 -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSXMLParser and multithreading
Excerpts from Mark Thomas's message of Tue Sep 16 11:36:41 -0400 2008: Was wondering if somebody could answer how thread safe NSXMLParser is, as I need to use it with NSURL set to remote server and the response could take a while, so this why I want to put off into another thread. Instances of NSXMLParser can be safely used from any thread, but only by one thread at a time. It would be acceptable to instantiate and remotely load the data from a secondary thread in your app. While I can see it can be used with a NSURL, is there a way I can do a HTTP POST with it when I pass it into a NSXMLParser ? As I want to parser the results which the server will send me. You'll need to do the POST yourself and then pass the response as an NSData to NSXMLParser. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: async NSOperation and NSOperationQueue
Excerpts from John Love's message of Mon Sep 15 11:02:21 -0400 2008: I must be doing something terribly wrong, because when I start up the NSOperationQueue that does some time consuming calculations, I do not get back control of my application until after the lengthy calculation is complete. Here are the relevant code snippets: At what point is your app sticking? After you start all the queues, but before you return from -startCalculation? - (void) calculateWorksheetRow:(id)data { // takes a long time here } - (void) startQueue { theQueue = [[[NSOperationQueue alloc] init] autorelease]; theOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(calculateWorksheetRow:) object:nil]; [theQueue addOperation:theOp]; } You're starting one queue per operation, but you really want one queue for all the operations. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Do I Need Multiple NSArrayControllers For This?
I found this informationhttp://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindi ngs/Tasks/filtering.html#//apple_ref/doc/uid/20002302-128168-CJBCJCAIabout overriding -arrangeObjects: Since I need to return several different arrays of objects (active, new, and prior) how is this different from multiple NSArrayControllers with predicate bindings. Perhaps creating methods like -activeObjects: -newObjects: that create the filtered arrays and pass those to -arrangeObjects:? The predicate bindings might be useful if you actually needed to access all the other subarrays, but since you just want the count, it's sufficient to just do it in the single controller. If you want to generalize you can probably add a key for a predicate which determines what the extra count you're maintaining is. You're of course welcome to have another array controller, but you'll end up having to keep it and the unfiltered controller in sync, which is really not worth the effort. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Question about dataWithPDFInsideRect:
Suppose I have a model (myModel) and its view (myModelView) which is a subclass of NSView. myModel has an update method that updates the model, and changes in the view are all drawn inside the drawRect: method of myModelView. If I have the following sequence: [ myModel update ]; [ myModelView setNeedsDisplay: YES ]; myModelViewData = [ myModelView dataWithPDFInsideRect: [ myModelView bounds ] ]; Is the data I get back from dataWithPDFInsideRect: guaranteed to reflect the last changes that stem from [ myModel update ]? Or is it possible that I might get data that's essentially cached from a view of the model from some previous state? Hope that makes sense. Yes; -[NSView dataWithPDFInsideRect:] will create a PDF graphics context and eventually end up calling -[NSView drawRect:] with the passed bounds. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Do I Need Multiple NSArrayControllers For This?
Just want to clarify this a bit. In the Bindings inspector, when I assign a value transformer, that gets applied to the Controller Key and then the Model Key Path portion applies to the transformed value. Am I understanding that correctly? The value transformer gets applied immediately before providing the value to the bound object; if you have a model key path (which, by the way, is not always required), it will get applied to the result of getting the value from the model key path of the model. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Do I Need Multiple NSArrayControllers For This?
Just want to clarify this a bit. In the Bindings inspector, when I assign a value transformer, that gets applied to the Controller Key and then the Model Key Path portion applies to the transformed value. Am I understanding that correctly? The value transformer gets applied immediately before providing the value to the bound object; if you have a model key path (which, by the way, is not always required), it will get applied to the result of getting the value from the model key path of the model. By the way, another way to implement this is to set a property in a subclass of NSArrayController inside its -arrangeObjects: method. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Do I Need Multiple NSArrayControllers For This?
I have a Core Data entity that has a date and relationship. I want to create a label like. 25 Foos (12 New) A Foo is active if it its relationship is null and it is new if its date is within the startDate and endDate specified by the user. My intuition is that this does require two NSArrayControllers each with a filter predicate binding to get the desired array of Foos, but I wanted to see if there was anything I hadn't considered. You might want a value transformer on the arrangedObjects of the array controller: one that just returns the count, and one that returns the count as filtered by a predicate. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTableView bindings and current selection
I have a tableView (showing query results) that has its values bound to an array controller; that works fine. I also have a NSPathControl showing the path of the selected item; this works fine too. I have implemented a right-click contextual menu to Show in Finder... the selected item in the tableView. My question is, how do I get the path of the selected item so my showInFinderMenuAction: method does as it's supposed to do? To be totally honest, even though I have got the menu working (it's a menuForEvent:theEvent method) and I can log the selected row correctly, I'm unsure of what to do next to implement the contextual menu. As the tableView implements bindings, I can't see a way of getting the selected items row/column value, let alone that row's path reference. You can get the clickedRow of the table view, and use that as an index into the array controller’s arranged content. (Be sure to use the clicked row, not the array controller’s selection, unless you change the selection itself on the right-click). -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Creating a runloop to handle specific mouse events
At one point, my application blocks the runloop and I have to poll for mouse events by calling [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]. I'm not happy with the polling. It seems to me that creating a separate thread and configuring its runloop to process the events I'm interested in (specific mouse events for a specific window) is a more elegant solution. I couldn't find any example code doing that. I suspect that it's not possible for third-party developers to tap into the event stream coming from the window server, to create a CFRunloopSource similar to the one that feeds the main runloop. This isn’t really polling as much as taking over the runloop and filtering out some events. There’s nothing really inelegant about this— it’s the call that powers the tracking loop in most of the controls in AppKit. If you really wanted, you could shuffle off the events to another thread for processing later. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSOutlineView developer example
Hi Guys, i tried to understand the NSOutlineView developer example which is in /Developer/Examples/AppKit/OutlineView. It simply shows the entire filesystem. I tried to alter it, so it shows any relative path of the filesystem, but whatever i do, it does not work. Does anybody have an idea, where to alter it, i.e to /Volumes/ Macintosh HD/path/to/directory, to show the tree from there only? Take a look at the implementation of +[FileSystemItem rootItem], which defines the root object in the outline view’s displayed hierarchy. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Best 'native' formats for NSImage and NSSound?
In running Shark on my app recently I noticed that by far, my app spent most of its time in: CGSConvertBGR888toRGBA. I'm having trouble understanding what this means. It appears that CoreGraphics is having to convert some of my non-alpha channel images to have an alpha, and perhaps re-order the bytes? But shouldn't these conversions only occur once, when CG realizes it needs this additional channel? NSImage should only be doing the conversion once unless you’re continually reloading the image from its original file. You should see an NSBitmapImageRep, in the target drawing context’s format, attached to the image after drawing. I don’t believe the sub-rect drawing behavior is any different. It’d be useful to see the relevant part of your Shark trace. My app is re-using the same NSImages each frame, simply compositing various sub-rects from the original large images. And also, seeing how much work NSImage is having to do, it got me wondering, are there any image/sound file formats which require 'less work' on the part of NSImage and NSSound? In terms of loading the initial data, unpacking the bytes, etc. I was wondering if switching to .TIFF or .AIFF (or any other formats) could possibly provide a performance boost? There’s no real guarantee for images, since the compositing buffer format isn’t specified, and is therefore subject to change at any time. If you’ve got a downloadable app, you may want to optimize for file size anyway. (The same advice applies for sounds.) -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Simulating menu bar blink in Cocoa
If I understand well, your trying to catch event that match a menu item shortcut minus the shift key. Isn't it possible to override - [NSApp sendEvent:] as you did, but instead of taking care of the event yourself, create a new event that match the menu item and then call super with this new event ? - (void)sendEvent:(NSEvent *)theEvent { if ([theEvent isAnHotkeyEvent]) { theEvent = [NSEvent eventWithTheKeystrokeAppKitWant]; } [super sendEvent:theEvent]; } I really don't know if it works, but it worth the try. That’s a pretty common way to do it, and avoids the need to duplicate the actual method dispatch. Works great. -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMapTable with pointer keys ?
[NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality valueOptions:NSMapTableStrongMemory] (reading the doc for NSMap, I figured these are the right options) However, when trying to fetch an object with a void* key to check for its presence (using the C api as recommended) NSMapGet(myMap, aKey); I get an instant crash and looking at the stack trace, it's because aKey is being sent an ObjC message, to which it will hard time replying since it's not an NSObject in the first place. That’s because you’ve marked the keys as being object pointers; you’ve got your key and value pointer functions reversed. (Also be sure you want the StrongMemory personality, and not OpaqueMemory.) -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: reading data from a UDP port - questions
(2) But in any case, NSString doesn't mind embedded null bytes. (It's not null-terminated like a C string; the string object remembers the length separately.) That doesn't mean you should store binary data in an NSString, though. NSData is better for that. NSString isn’t really too happy with embedded NULLs. See the documentation for the initWith___: methods, which are littered with the statement “must not contain NULL.” -Ben___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Best way to hook up Font Panel to floater (that isn't first responder)?
Is there a way to hook up the Font Panel directly? This needs to be spring loaded so that the Font Panel follows the user's focus most of the time, but switches to my panel when the user clicks the Font button but returns to the original 1stR when they go back to the main document. Or maybe my thinking is just wrong? Check out -[NSFontManager setTarget:]. -Ben ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]