lastKeyViewTraversingSubviewsBeginningWithView
Hi Cocoa List, I'm occasionally seeing the following warning from the runtime while testing my application: warning: _lastKeyViewTraversingSubviewsBeginningWithView: encountered 5000 views!!! It usually occurs when a NSCollectionView is being refreshed, but not every time. I've tried Googling for this error with no help, and it doesn't seem to appear in the documentation either. Anyone know what it means, or what the likely cause could be? It doesn't seem to be affecting anything during testing. My test data has just over 5000 items, but the collection view is only ever displaying just over 1000 items. Thanks in advance, Arved___ 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
lastKeyViewTraversingSubviewsBeginningWithView
Hi Cocoa List, I'm occasionally seeing the following warning from the runtime while testing my application: warning: _lastKeyViewTraversingSubviewsBeginningWithView: encountered 5000 views!!! It usually occurs when a NSCollectionView is being refreshed, but not every time. I've tried Googling for this error with no help, and it doesn't seem to appear in the documentation either. Anyone know what it means, or what the likely cause could be? It doesn't seem to be affecting anything during testing. My test data has just over 5000 items, but the collection view is only ever displaying just over 1000 items. Thanks in advance, Arved___ 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: Cocoa equivalent for 'InstallApplicationEventHandler'
Hi all, Thanks for the prompt responses. As Jesper mentioned, I would like my app to work on 10.5 as well. I forgot to mention that in my earlier mail. Ordinarily it doesn't make any sense to type into an app that has no open windows. If you have special hot keys that should do something even in this state (like maybe the Help key opening your help window), you can create menu items for those actions and set those keystrokes as their shortcuts. Yes, I would agree that it is not generally a good practice. However, there are certain things that I would like the app to do in a no-window state for which tapping into the app would make sense. I believe that overriding sendEvent seems to be better choice as of now. Thanks again, Vikram On Sat, Feb 20, 2010 at 11:21 PM, Jesper Storm Bache jsba...@adobe.comwrote: Your comment only pertains to the addGlobal... You can use addLocalMonitor to only snoop on events in your process. From the header: = Use +addLocal to install an event monitor that receives events before they are dispatched by -[NSApplication sendEvent:]. In this case, your block should either return a valid NSEvent (which may be the same as the incoming NSEvent, or may be a newly created NSEvent) to cause the event to be dispatched, or it may return nil to stop dispatching of the event. Note that your handler will not be called for events that are consumed by nested event-tracking loops such as control tracking, menu tracking, or window dragging; only events that are dispatched through -[NSApplication sendEvent:] will be passed to your handler. = addLocalMonitor is 10.6 only and you can view it as a somewhat similar to installing a handler on the Carbon event dispatcher. If you want a solution that works on systems before 10.6, consider either overriding NSApplication sendEvent, or using a local (process specific) event tap. Jesper On Feb 20, 2010, at 4:08 AM, Uli Kusterer wrote: On 20.02.2010, at 12:53, Tom Davie wrote: You want NSEvent's + (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)*mask* handler:(void (^)(NSEvent*))*block* *and* * + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* (^)(NSEvent*))block Nope, that's the wrong choice. This would give him copies of events sent to *other* applications as well (hence the global). The sendEvent override seems like the most workable solution to me so far. Though I'd suggest not doing the work directly in your application instance. Instead, forward the event to your delegate. That way, you can use the same NSApplication subclass in your other apps. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://groups.yahoo.com/group/mac-gui-dev/ ___ 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/jsbache%40adobe.com This email sent to jsba...@adobe.com -- Ξ √ί...@m Ŝεth! Ξ ___ 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
Problem with one-way Core Data relationship not persisting
I have a problem with the core data object graph not properly persisting: Managed Object A (Car) has a one-way, one-to-many relationship to several Managed Object B's. (Tires) When I create the object graph, I use the standard generated relationship set mutator methods to setup the relationships: [carMO addTireObject:tireMO] After creating the full object graph, I have validated that everything is correct. Reviewing the relationship sets show 4 tires in the set of the car relationship. Yet, when I save this to the persistent store and either reset the MOC or rerun the app and access the previously saved data, everything is there but many of the relationships noted above are missing. *If I switch the type to a 2-way inverse relationship (many-to-many), it all works fine * Without going into too much detail, establishing this with the inverse is causing a dramatic and not acceptable increase in the time to save and also the size of the store. (1M+ cars, 50 tires each for example). My question is not around the performance issue with the inverse. I would like to understand why the one-way relationship is not sticking. I don't need the inverse and the cost is too high. I have tried making sure that all the tires are flushed to the persistent store and have permanent ID's first; no change in the above. Also, as I mentioned, it is not 100% of the relationships that are missing. I can not find a pattern and roughly 90% are not sticking. Any insight into using a one-way one-to-many relationship? Thanks, Greg ___ 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: lastKeyViewTraversingSubviewsBeginningWithView
On 2/21/10 5:53 AM, Arved von Brasch wrote: Hi Cocoa List, I'm occasionally seeing the following warning from the runtime while testing my application: warning: _lastKeyViewTraversingSubviewsBeginningWithView: encountered 5000 views!!! It usually occurs when a NSCollectionView is being refreshed, but not every time. I've tried Googling for this error with no help, and it doesn't seem to appear in the documentation either. Anyone know what it means, or what the likely cause could be? It doesn't seem to be affecting anything during testing. My test data has just over 5000 items, but the collection view is only ever displaying just over 1000 items. Thanks in advance, Arved I believe that NSCollectionView creates all of the item views up front, and doesn't lazily create them or destroy them. So, there really are 5000+ subviews. You should take a look at the collection view's subviews to see. -- Joe Ranieri ___ 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: Extract keys, values from 'usrf' Record Type NSAppleEventDescriptor?
Hi Jerry- You're going to want to look at NSAppleEventDescriptor's numberOfItems, keywordForDescriptorAtIndex: and descriptorAtIndex: methods, and play around with them a little. One thing to keep in mind is that the lists are 1-based, so start looking at index 1 :-) It's been quite some time since I played with this, so consider the below as suggestions rather than known truth... For the descriptor you logged, there should be one item, keywordForDescriptorAtIndex:1 should return 'usrf', and descriptorAtIndex:1 will return a descriptor that you can further interrogate (lets call it info). NSAppleEventDescriptor also has methods to return values for descriptors. To get at the data you are looking for you'll need to use the stringValue method to fish out the data. Consider the following (email typed, untested) snippet to access the data NSMutableDictionary *tempDict = [NSMutableDictionary dictionary]; NSUInteger i, count = 2; for(i = 1; i = count; i++){ NSString *newKey = [[info descriptorAtIndex:(2*i-1)] stringValue]; NSString *newValue = [info descriptorAtIndex:(2*i)] stringValue]; [tempDict addObject:newValue for Key:newKey]; } You should now have a dictionary where aNam = Apple and aUrl = http://www.apple.com Hope this helps! John On Feb 20, 2010, at 10:15 PM, Jerry Krinock wrote: I create an NSAppleScript to read the current window name and URL from Safari and return it as a record [1]. When I execute it, I get a nice-looking NSAppleEventDescriptor with the following -description (line breaks added for readability): NSAppleEventDescriptor: { 'usrf': [ 'utxt'(aNam), 'utxt'(Apple), 'utxt'(aUrl), 'utxt'(http://www.apple.com;) ] } As you can see, the desired keys and values are all in there. How can I get them out? (Spent an hour reading documentation to no avail.) Thanks, Jerry Krinock [1] tell application Safari set aName to name of front document set aUrl to URL of front document end tell set aRecord to {aNam:aName, aUrl:aUrl} ___ 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/john%40positivespinmedia.com This email sent to j...@positivespinmedia.com ___ 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: setAction:@selector is not working ?
On 22/02/2010, at 2:11 AM, slasktrattena...@gmail.com wrote: id string = [NSString stringWithCString:sel_getName(command) encoding:NSMacOSRomanStringEncoding]; Just a tip: look up NSStringFromSelector(); --Graham ___ 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
UILabel updating from a button click
Hi, I have, for a bit of fun, taken my first steps out of Mac development and into iPhone development, and have encountered a bit of a problem. Basically, what I want to do is update a UILabel when a button is clicked in the view, but I want to be able to update it in intervals with different values. I have tried basically doing this (although this is simplified for the purposes of demonstration) in the IBAction for the button click event: for (int i = 0; i 10; ++i) { label.text = [stringList objectAtIndex:i]; sleep(1); } What happens is that I only see the last value that is set - does anyone here know what I should be doing to code this correctly? Mikey___ 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: UILabel updating from a button click
Please don't use sleep() on the main thread of a UI application.. If you really want to do this, I'd suggest using an ivar or a static variable to facilitate going through the operation using performSelector:withObject:afterDelay: e.g.: static int labelLoopCounter = 10; -(IBAction)buttonPressed { if (labelLoopCounter == 10) { labelLoopCounter = 0; [self updateLabel]; } } -(void)updateLabel { if (labelLoopCounter 10) { label.text = [stringList objectAtIndex:labelLoopCounter]; labelLoopCounter++; [self performSelector:@selector(updateLabel) withObject:nil afterDelay:1.0]; } } On Feb 21, 2010, at 7:33 AM, Michael Davey wrote: Hi, I have, for a bit of fun, taken my first steps out of Mac development and into iPhone development, and have encountered a bit of a problem. Basically, what I want to do is update a UILabel when a button is clicked in the view, but I want to be able to update it in intervals with different values. I have tried basically doing this (although this is simplified for the purposes of demonstration) in the IBAction for the button click event: for (int i = 0; i 10; ++i) { label.text = [stringList objectAtIndex:i]; sleep(1); } What happens is that I only see the last value that is set - does anyone here know what I should be doing to code this correctly? Mikey___ 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/luketheh%40apple.com This email sent to luket...@apple.com ___ 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: Cocoa equivalent for 'InstallApplicationEventHandler'
On Feb 21, 2010, at 3:05 AM, Vikram Sethi wrote: Yes, I would agree that it is not generally a good practice. However, there are certain things that I would like the app to do in a no-window state for which tapping into the app would make sense. Keep in mind that many users don't really understand the concept of an app that's running but has no windows open. Common problems are I can't open the app (they click on the Dock icon but no window opens; was largely fixed by the 'rapp' AppleEvent in System 7.1) and I'm looking for the Foo menu but it's not there anymore (they see a window for that app but don't notice that another app with no windows is active, so they're clicking into the wrong menu bar.) You may laugh, but this is really widespread. So behaviors like what you're describing could cause a lot of confusion, unless your app is only targeted at geeks and power-users :) —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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Removing item from CollectionView by drag it out.
Hi Sandro, it seems, that NSCollectionViews are not used very frequently, among the Members of this list. I've asked several questions regarding NSCollectionsViews here, but almost never got a reply. I've never done dragdrop from or to a NSCollectionView, so I can't help you either. I've done it among the items in the View but never used the techniques introduced in 10.6. Sorry... regards, Joachim Am 20.02.2010 um 20:58 schrieb Sandro Noël: So should I understand that NCCollectionView as a Drag Source is Broken enough for no one in this list to pay it attention? Has anyone got it working? I'm Confused. Drop destination works like a charm for me, just by implementing the NSCollectionViewDelegate protocol as part of my window controller the delegate being set for the Collection view in interface builder as the window controller. There are also methods for the drag Source but i can't seem to get them working properly. I can drag my item from the CollectionView to another CollectionView, the drop get's accepted but then, i get an error about URL's, i've never asked for URL's as a mater of fact my destination accepts only one type. NSFilenamesPboardType which is an array of strings containing file path. that is exactly what i construct to past to the pasteboard as so. - (BOOL)collectionView:(NSCollectionView *)collectionView writeItemsAtIndexes:(NSIndexSet *)indexes toPasteboard:(NSPasteboard *)pasteboard{ ENTERING(); [pasteboard clearContents]; [pasteboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; // we only allow one object to be selected. DItem *object = [[itemsArrayController selectedObjects] objectAtIndex:0]; [pasteboard writeObjects:[NSArray arrayWithObject:object.path]]; return YES; } [30040:a0f] Looked for URLs on the pasteboard, but found none. any clue is welcome. thanks Sandro.___ 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/cocoa-dev%40deelen.de This email sent to cocoa-...@deelen.de ___ 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
call ruby scripts from objective c
Hello, I have a Cocoa app that tries to take advantage of existing ruby code. I basically want to use several scripts from a RubyCocoa application in my app. Is there a way to do that? Thanks, Rainer ___ 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: Extract keys, values from 'usrf' Record Type NSAppleEventDescriptor?
Jerry Krinock wrote: I create an NSAppleScript to read the current window name and URL from Safari and return it as a record [1]. When I execute it, I get a nice-looking NSAppleEventDescriptor with the following -description (line breaks added for readability): NSAppleEventDescriptor: { 'usrf': [ 'utxt'(aNam), 'utxt'(Apple), 'utxt'(aUrl), 'utxt'(http://www.apple.com;) ] } As you can see, the desired keys and values are all in there. How can I get them out? (Spent an hour reading documentation to no avail.) ObjC-appscript has an AEMCodecs class that includes code for packing and unpacking AppleScript-style records, if you don't mind embedding the Appscript framework or extracting the classes you want by hand. (I've received a patch from another appscript user to break out AEMCodecs and some other bits for this sort of use, but I've been too busy recently to apply it.) tell application Safari set aName to name of front document set aUrl to URL of front document end tell set aRecord to {aNam:aName, aUrl:aUrl} Unless the script needs to be user supplied, you could skip the NSAppleScript bit altogether. e.g. Running the above script through ASTranslate (from the appscript website) gives me the following raw code, which'd clean up nicely: #import SFGlue/SFGlue.h SFApplication *safari = [SFApplication applicationWithName: @Safari]; SFReference *ref = [[[safari documents] at: 1] name]; id result = [ref getItem]; #import SFGlue/SFGlue.h SFApplication *safari = [SFApplication applicationWithName: @Safari]; SFReference *ref = [[[safari documents] at: 1] URL]; id result = [ref getItem]; Or there's Apple's own bridge - not as good, but I'm guessing it would work for this. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Rotating an NSImage around it's own center as well as offset to origin
I would like to rotate and offset an NSImage and then draw it onto an NSImageView. So far I figured out to use Quartz and use CGContextRotateCTM and CGContextTranslateCTM. I got the offset working just fine using this, but as soon as I introduce the rotation it rotates the image relative to the origin, rather then the centre. I figure I need to do a combination of CGContextTranslateCTM to move the centre of the image to the origin, then apply a CGContextRotateCTM to rotate it and then move it back, but I can't figure out how to best do this. Are there any other options of doing this please let me know. I had a look online, but all the suggestions I found seem too complicated as there must be a simple solution to this (I hope). ... int resultWidth = 1600; int resultHeight = 1200; float foregroundXoffset= 50; float foregroundYoffset= 50; float foregroundRotation = 10; NSData *tiff_data = [[NSData alloc] initWithData:[[backgroundImage image] TIFFRepresentation]]; NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc] initWithData:tiff_data]; CGImageRef imageBackground = CGImageRetain([bitmap CGImage]); int width = 0; int height = 0; width = CGImageGetWidth(imageBackground); height = CGImageGetHeight(imageBackground); CGContextSaveGState(context); CGContextRotateCTM(context, foregrounRotation); CGContextTranslateCTM (context, foregroundXoffset, foregroundYoffset); CGContextDrawImage(context, imageRect, imageBackground); CGImageRelease(imageBackground); CGContextRestoreGState(context); ... Thanks in advance Alex___ 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: Rotating an NSImage around it's own center as well as offset to origin
On 22/02/2010, at 10:43 AM, Alexander Hartner wrote: I would like to rotate and offset an NSImage and then draw it onto an NSImageView. So far I figured out to use Quartz and use CGContextRotateCTM and CGContextTranslateCTM. I got the offset working just fine using this, but as soon as I introduce the rotation it rotates the image relative to the origin, rather then the centre. I figure I need to do a combination of CGContextTranslateCTM to move the centre of the image to the origin, then apply a CGContextRotateCTM to rotate it and then move it back, but I can't figure out how to best do this. Are there any other options of doing this please let me know. I had a look online, but all the suggestions I found seem too complicated as there must be a simple solution to this (I hope). CGContextSaveGState(context); CGContextRotateCTM(context, foregrounRotation); CGContextTranslateCTM (context, foregroundXoffset, foregroundYoffset); CGContextDrawImage(context, imageRect, imageBackground); CGImageRelease(imageBackground); CGContextRestoreGState(context); ... Thanks in advance Alex To rotate around the centre of an image, first translate (move) the image origin to the centre of your frame, then rotate, then move the image back. You've rotated first and then moved it. CGContextTranslateCTM(ctx, distanceXtoCentre, distanceYtoCentre); CGContextRotateCTM(ctx, rotationValue); CGContextTranslateCTM(ctx, -distanceXtoCentre, -distanceYtoCentre); HTH, Ron ___ 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: Document not Saving Text View Attachment
On Sun, Feb 21, 2010 at 2:00 PM, Gordon Apple g...@ed4u.com wrote: This is getting stranger by the minute. I ruled out the menu issue as the cause, then created a test app from the standard doc template. Window contain a scrolling text view and a button. The app edits and archives correctly (compiled using GC). init sets an initial string in ts. The text view is bound to ts. You need to post the code that sets up the text system. Unless you actually meant bound in the sense of Cocoa Bindings, in which case none of this is ever going to work because then the text view will operate on a copy of the text storage you've provided. The only way to get the text view to use your text storage is to set it up yourself. --Kyle Sluder ___ 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
NSPredicateEditor losing nextKeyView
In my sheet, I have a name NSTextField and an NSPredicateEditor. Initially, the tab key works to jump between my name field and the first match field in the predicate editor. However, after changing any of the menus in the line of my predicate editor, the tab key no longer allows the keyfield to rotate out of the NSPredicateEditor back to other fields in my sheet. Is this a bug or do I need to hook up something to make it work? Thanks, Trygve ___ 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: Document not Saving Text View Attachment
Well, I was going to argue with you, but your post triggered further investigation. I realized that in the past, I had constructed my own. Somehow, in this case, I got it in my head that the bindings would make the text view use my NSTextStorage. Duh. So I changed to the following in the test app: @interface MyDocument : NSDocument { IBOutlet NSTextView* tv; NSAttributedString* ts; } @property(copy) NSAttributedString* ts; - (IBAction)insertSomething:(id)sender; @end - (IBAction)insertSomething:(id)sender { NSUInteger index = [tv selectedRange].location; NSTextStorage* vtc = [tv textStorage]; [vtc beginEditing]; [vtc insertAttributedString:[[NSAttributedString alloc] initWithString:@XYZ] atIndex:index]; [vtc endEditing]; } At least now, I'm dinging the right text storage and the insertion works. However, it does confirm my original problem, i.e., that the programmatic edit does not show up in the bound NSAttributedString unless there is an additional text-entry edit. Now I'm thinking bug report, unless there is something else I can do to trigger the KVO for programmatic edits. I suppose a workaround could be to set up a dummy ivar and a dependency to make it update. On 2/21/10 7:24 PM, Kyle Sluder kyle.slu...@gmail.com wrote: On Sun, Feb 21, 2010 at 2:00 PM, Gordon Apple g...@ed4u.com wrote: This is getting stranger by the minute. I ruled out the menu issue as the cause, then created a test app from the standard doc template. Window contain a scrolling text view and a button. The app edits and archives correctly (compiled using GC). init sets an initial string in ts. The text view is bound to ts. You need to post the code that sets up the text system. Unless you actually meant bound in the sense of Cocoa Bindings, in which case none of this is ever going to work because then the text view will operate on a copy of the text storage you've provided. The only way to get the text view to use your text storage is to set it up yourself. --Kyle Sluder ___ 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: NSPredicateEditor losing nextKeyView
On Feb 21, 2010, at 9:50 PM, Trygve Inda wrote: In my sheet, I have a name NSTextField and an NSPredicateEditor. Initially, the tab key works to jump between my name field and the first match field in the predicate editor. However, after changing any of the menus in the line of my predicate editor, the tab key no longer allows the keyfield to rotate out of the NSPredicateEditor back to other fields in my sheet. Is this a bug or do I need to hook up something to make it work? I noticed this happening sometimes in my code too. As a quick fix I just issued a delayed -recalculateKeyViewLoop message on any change of the search predicate when the view was visible. Ashley ___ 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: Extract keys, values from 'usrf' Record Type NSAppleEventDescriptor?
Thanks, John and HAS. It turned out that after all was said and done, things were more complicted. I needed to be able to plug in a half dozen scripts, most of them a couple dozen lines, using some System Events GUI scripting. So I decided to ship them in Contents/Resources so they could be separately debugged and tested. ObjC-appscript looks interesting but I already had it pretty well done before I read HAS's message, and it's not too much code, although I find it odd that Cocoa wouldn't have a method built in for doing this, and VERY odd that the descriptors use 1-based indexing like AppleScript. That was my main problem, John! John's code was very close. Here's the meat of the final version: NSAppleEventDescriptor* descriptor = [script executeAndReturnError:NULL] ; NSMutableDictionary* info = [NSMutableDictionary dictionary] ; NSInteger i ; for (i=1; i=[descriptor numberOfItems]; i++) { // This loop should only execute once; [descriptor numberOfItems] = 1 NSAppleEventDescriptor* subdescriptor = [descriptor descriptorAtIndex:i] ; NSInteger nItems = [subdescriptor numberOfItems] ; // nItems should be 2 x number of values in the record if ((nItems 0) (nItems%2 == 0)) { NSUInteger j ; for(j=1; j=[subdescriptor numberOfItems]/2; j++){ NSString* key = [[subdescriptor descriptorAtIndex:(2*j-1)] stringValue] ; NSString* value = [[subdescriptor descriptorAtIndex:(2*j)] stringValue] ; if (key value) { [browmarkInfo setObject:value forKey:key] ; } } break ; } } ___ 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
Determine if only single instance is running.
Hi list, Is there a way to check an application instance is running. I tried enabling application prohibits multiple instance in info.plist. Still i am able to launch multiple instance of the same application. Thanks, Poonam ___ 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
Removing quit button from dock menu
Hi everyone, I have an application for which I have to remove quitting option. Anybody has idea how to remove it from the dock menu. Thanks, -- YOGIN BHARGAVA, Flat No TF-2, Phase 4, Lotus Krest, Kundalahalli Colony, ITPL Main Road, Bangalore-560067 ___ 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