Re: Knowing how a Text Editing Session ended

2010-07-22 Thread Motti Shneor
Thanks Mike --- Following your recommendation and the docs, I managed to extract the value of the @"NSTextMovement" key from the notification userInfo Dictionary, which contains just what I needed. However, I found that my problem is a bit deeper --- I want to finish the text editing session

Array controllers in code?

2010-07-22 Thread Amy Gibbs
Hi, Apologies in advance for being stupid! I've got an app I'm trying to create, using Core Data, I created the data model, and Dragged some of the interface into place in the nib. I've almost got the bindings sorted so it's got Array controllers for all the entities, and it's pretty much

Re: cocoa app is cancelling shutdown

2010-07-22 Thread Alastair Houghton
On 22 Jul 2010, at 05:30, Kyle Sluder wrote: > On Wed, Jul 21, 2010 at 3:27 AM, Elizabeth Kellner wrote: >> Second is that this app is being launched programmatically from >> another app, using [NSTask launchedTaskWithLaunchPath:arguments:]. If >> I launch the app directly, it does not seem to i

loading French strings being in English language

2010-07-22 Thread cocoa learner
Hi All, I have localized my app in English and French languages. But I want to load French strings being in English language based on radio button input (English and French). Is it possible? Is there any cocoa way of doing this? Regards Cocoa.learner _

Re: loading French strings being in English language

2010-07-22 Thread cocoa learner
Thanks GT for your reply and interest. I know one way that preparing a key-value dictionary from string table and rendering those. But at the same time I would like the input to change as well. That is if French is selected then the input (keyboard) also change to French input. So I am looking for

Re: Array controllers in code?

2010-07-22 Thread Laurent Demaret
Amy Gibbs wrote: > how do > I reference the Arrays/Array controllers in the code? >. I've > added a 'calculate' button, so now I just need to take the 2 > properties from the selected product, do the maths, and set the cost > property with the result. Why don't use use bindings of the bu

Re: Array controllers in code?

2010-07-22 Thread Jack Nutting
The simplest way is to create action methods in your controller class, along with ivars for the array controllers you need to access, something like this in the header: @interface MyController : NSObject { IBOutlet NSArrayController *masterController; IBOutlet NSArrayController *detailControll

print object by %@

2010-07-22 Thread Ariel Feinerman
Hi developers, I search in google, but can see nothing. Is there Cocoa fuction for objects like printf(), without timestamps? -- best regards Ariel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: print object by %@

2010-07-22 Thread Rui Pacheco
Could you be looking for NSLog? http://www.cocoadev.com/index.pl?NSLog On 22 July 2010 12:32, Ariel Feinerman wrote: > Hi developers, > > I search in google, but can see nothing. Is there Cocoa fuction for objects > like printf(), without timestamps? > > -- > best regards > Ariel >

Re: print object by %@

2010-07-22 Thread Ron Fleckner
On 22/07/2010, at 9:32 PM, Ariel Feinerman wrote: > Hi developers, > > I search in google, but can see nothing. Is there Cocoa fuction for objects > like printf(), without timestamps? > > -- > best regards > Ariel Depending on the information you want to see in printf, you can use NSStringFr

Re: print object by %@

2010-07-22 Thread Jean-Daniel Dupas
Le 22 juil. 2010 à 13:32, Ariel Feinerman a écrit : > Hi developers, > > I search in google, but can see nothing. Is there Cocoa fuction for objects > like printf(), without timestamps? Not the most efficient way, but straightforward for debugging purpose: printf("%s", [[NSString stringWithFor

Re: Discard all drawing in a UIView

2010-07-22 Thread Steve Christensen
I think a more basic question is what you're doing in -drawRect that would generate an exception in the first place. Typically a view should already have access to any relevant resources (strings, images, whatever) before -drawRect is ever called. Assuming that the exception is a reasonable erro

Re: cocoa app is cancelling shutdown

2010-07-22 Thread Ken Thomases
On Jul 21, 2010, at 5:27 AM, Elizabeth Kellner wrote: > First is that app in question is a cocoa app that previously was a > command line app, and so it is *not* calling NSApplicationMain. It > starts its own run loop. Although I'm calling CFRunLoopRunInMode in > the loop, could there be some ot

Re: Knowing how a Text Editing Session ended

2010-07-22 Thread Keary Suska
On Jul 22, 2010, at 2:47 AM, Motti Shneor wrote: > Thanks Mike --- Following your recommendation and the docs, I managed to > extract the value of the @"NSTextMovement" key from the notification userInfo > Dictionary, which contains just what I needed. > > However, I found that my problem is a

Re: How to grab content of CALayer and sublayers into a bitmap

2010-07-22 Thread Kevin Wojniak
Depending on your needs, the CGWindow API may do what you want. It can generate images of windows, and then you could crop the image down. But if you're going for transparency that probably won't work. On Jul 21, 2010, at 10:55 AM, Oleg Krupnov wrote: > Hi, > > I need to make a snapshot of a

Small caps in NSTextView

2010-07-22 Thread Vincent Habchi
Hi! I'd like to highlight some text in a NSTextView by showing it in small caps. It seems this is not a standard text attribute, so this is not possible unless changing [NSTextView string] contents. Is this right? Thanks! Vincent___ Cocoa-dev mailing

Re: Knowing how a Text Editing Session ended

2010-07-22 Thread Ross Carter
On Jul 22, 2010, at 4:47 AM, Motti Shneor wrote: > My Question: How can I Persuade the FieldEditor to end an Editing Session > when these specific key-combinations occur? Should I override something? Is > there a specific Delegate for that? You might try subclassing the field editor and overri

Re: Small caps in NSTextView

2010-07-22 Thread Ross Carter
On Jul 22, 2010, at 11:44 AM, Vincent Habchi wrote: > I'd like to highlight some text in a NSTextView by showing it in small caps. > It seems this is not a standard text attribute, so this is not possible > unless changing [NSTextView string] contents. Is this right? No, you do not have to modi

Re: Small caps in NSTextView

2010-07-22 Thread vincent habchi
Ross, thanks a lot for your hints. > Small caps is not a trivial thing to implement, especially if you care about > how they look. Not too much. I just want to dynamically highlight keywords in a SQL sentence (e.g. out of "select * from" -> "SELECT * FROM"). My present solution is to get the

Re: print object by %@

2010-07-22 Thread Ariel Feinerman
Thank you for yours, but I am looking for more convenient way, I mean a function for console output, not for debugging like NSLog(), so I wish: NSLog(@"object is %@", obj); // $ object is [object description] I would not wish to convert NSString to utf8 for printf(), I wish to use NSString 2010/

Deselect keyboard focus of an NSMatrix cell

2010-07-22 Thread Jochen Moeller
Greetings, I want to be able to deselect the keyboard focus of a control after hitting Return, whereas Tab moves to the nextKeyView. When using editable NSTextField objects I can achieve this in the action method with: [ window makeFirstResponder:[ window contentView ]]; But when using ed

Re: print object by %@

2010-07-22 Thread Stephen J. Butler
On Thu, Jul 22, 2010 at 12:57 PM, Ariel Feinerman wrote: > Thank you for yours, but I am looking for more convenient way, I mean a > function for console output, not for debugging like NSLog(), > > so I wish: > > NSLog(@"object is %@", obj); > // $ object is [object description] > > I would not wi

Re: Array controllers in code?

2010-07-22 Thread Amy Gibbs
Fantastic, Thank You, got that bit working, just for reference I've got the following: @interface ishop_AppDelegate : NSObject { IBOutlet NSWindow *window; IBOutlet NSArrayController *Products; NSPersistentStoreCoordinator *persistentStoreCoordinator; NSManagedObjectModel *

Re: print object by %@

2010-07-22 Thread Ariel Feinerman
Stephen, you are right, I wish to get a function can use printf style, prints Objective-C objects clearly and efficiently by %@, I do not understand, hm, why there is no such function (except NSLog()) in Cocoa? Charlie, -desription message can return localized NSString, so using of utf16 is nec

Re: Array controllers in code?

2010-07-22 Thread mmalc Crawford
On Jul 22, 2010, at 2:05 am, Amy Gibbs wrote: > Some things I want to do though need to be actually coded, but how do I > reference the Arrays/Array controllers in the code? Do I need to declare > them? They aren't at the moment that I can see, but somehow it's using them. > All the tutorials

Re: Array controllers in code?

2010-07-22 Thread Ken Thomases
On Jul 22, 2010, at 1:20 PM, Amy Gibbs wrote: > double *price, *uom, *cost; You have declared pointers to double, a scalar type. "double" is _not_ an object type. > price = [Product valueForKey:@"UOMcost"]; > uom = [Product valueForKey:@"purchaseUOM"]; The above is wrong, an

Re: print object by %@

2010-07-22 Thread Ken Thomases
On Jul 22, 2010, at 1:44 PM, Ariel Feinerman wrote: > you are right, I wish to get a function can use printf style, prints > Objective-C objects clearly and efficiently by %@, > > I do not understand, hm, why there is no such function (except NSLog()) in > Cocoa? You've been given all of the t

Re: print object by %@ [solved]

2010-07-22 Thread Ariel Feinerman
Ken, thank you, I have not known about -initWithFormat:arguments: is excellent message, I think I find function I am looking for, http://cocoaheads.byu.edu/wiki/different-nslog 2010/7/22 Ken Thomases > On Jul 22, 2010, at 1:44 PM, Ariel Feinerman wrote: > > > you are right, I wish to get a fun

Fast enumeration

2010-07-22 Thread Charlie Dickman
In the past I have used the construct NSEnumerator *_enumerator = [_array objectEnumerator]; id _id = nil; while (nil != (_id = [_enumerator nextObject])) { . . . if (condition) break; } if (nil == _id) { . . . } to determine if the entire contents of _array had been investigated and, if not

Re: Array controllers in code?

2010-07-22 Thread Amy Gibbs
I've tried declaring all sorts of things trying to get it to work :D float, decimal, (the entity properties are decimal in the datamodel), NSNumber, but I still get the error: invalid operands to binary / I assume I can't use int as the figures aren't integers, I only need it to 2 decimal p

Re: Fast enumeration

2010-07-22 Thread Quincey Morris
On Jul 22, 2010, at 12:16, Charlie Dickman wrote: > When trying to use, instead, > > for (id _id in _array) { > } > > how, without reverting to effectively using an enumerator as in > > id theID = nil; > for (id _id in _array) { > . > . > . > if (condition) { > theID = _id; > break; > } > .

Re: Array controllers in code?

2010-07-22 Thread Kyle Sluder
On Thu, Jul 22, 2010 at 1:03 PM, Amy Gibbs wrote: > I've tried declaring all sorts of things trying to get it to work :D float, > decimal, (the entity properties are decimal in the datamodel), NSNumber, but > I still get the error: invalid operands to binary / Step one: stop thrashing. The compi

Re: Array controllers in code?

2010-07-22 Thread Quincey Morris
On Jul 22, 2010, at 13:03, Amy Gibbs wrote: > I've tried declaring all sorts of things trying to get it to work :D float, > decimal, (the entity properties are decimal in the datamodel), NSNumber, but > I still get the error: invalid operands to binary / > > I assume I can't use int as the figu

Re: Deselect keyboard focus of an NSMatrix cell

2010-07-22 Thread Kyle Sluder
On Thu, Jul 22, 2010 at 11:05 AM, Jochen Moeller wrote: > Greetings, > > I want to be able to deselect the keyboard focus of a control after hitting > Return, whereas Tab moves to the nextKeyView. This is accomplished by the field editor. See the documentation for -[NSText isFieldEditor]. > > W

Re: print object by %@

2010-07-22 Thread Jean-Daniel Dupas
So replace printf by asl_log. And if this is not convenient enough: #define MyLog(fmt, ...) asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "%s", [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]) Or if you prefere a function void MyLog(NSString *fmt, ...) { va_list args; va_start(args, fm

LSUIElement vs applicationShouldTerminate:

2010-07-22 Thread Iceberg-Dev
As far as I can tell, when LSUIElement is set to 1, applicationShouldTerminate: is not called when a Cocoa application receive a terminate request. Is there a way in this case to prevent the application from being terminated by friend terminate requests (SIGTERM would be accepted)? Mac O

Re: print object by %@

2010-07-22 Thread Clark Cox
On Thu, Jul 22, 2010 at 11:44 AM, Ariel Feinerman wrote: > Stephen, > you are right, I wish to get a function can use printf style, prints > Objective-C objects clearly and efficiently  by %@, > > I do not understand, hm, why there is no such function (except NSLog())  in > Cocoa? > > Charlie, > -

Re: Fast enumeration

2010-07-22 Thread Jonathon Kuo
On Jul 22, 2010, at 1:10 PM, Quincey Morris wrote: > id _id; > > for (_id in array) { > } > > if (_id) > { > } If I use this to go backward through the array: for (_id in [array reverseObjectEnumerator]) { } ...is it still considered 'fast' enumeration? -Jon __

Re: Fast enumeration

2010-07-22 Thread Graham Cox
On 23/07/2010, at 9:28 AM, Jonathon Kuo wrote: > If I use this to go backward through the array: > > for (_id in [array reverseObjectEnumerator]) { > } > > ...is it still considered 'fast' enumeration? Yes, NSEnumerator conforms to the fast enumeration protocol. --Graham _

Re: Fast enumeration

2010-07-22 Thread Quincey Morris
On Jul 22, 2010, at 16:37, Graham Cox wrote: > On 23/07/2010, at 9:28 AM, Jonathon Kuo wrote: > >> If I use this to go backward through the array: >> >> for (_id in [array reverseObjectEnumerator]) { >> } >> >> ...is it still considered 'fast' enumeration? > > > Yes, NSEnumerator conforms

Re: Deselect keyboard focus of an NSMatrix cell

2010-07-22 Thread Jochen Moeller
Hello Kyle, thanks for your answer. I did as you suggested. But both -makeFirstResponder: and -resignFirstResponder return YES after pressing Return in the textFieldCell. So in my new test version the focus should move to an NSTextField after Return is pressed in the textFieldCell within the N

NSPropertyListSerialization and string encoding

2010-07-22 Thread Joe Turner
Hello, I'm having an issue with NSPropertyListSerialization, where I will call dataWithPropertyList:format:options:error:, to get the data from a property list–this part goes fine. However, then I need the data as a string, so I can upload it to a web service. However, when I call initWithData:

Re: NSPropertyListSerialization and string encoding

2010-07-22 Thread James Walker
On 7/22/2010 6:25 PM, Joe Turner wrote: I'm having an issue with NSPropertyListSerialization, where I will call dataWithPropertyList:format:options:error:, to get the data from a property list–this part goes fine. However, then I need the data as a string, so I can upload it to a web service. Ho

Re: NSPropertyListSerialization and string encoding

2010-07-22 Thread Kyle Sluder
On Thu, Jul 22, 2010 at 6:25 PM, Joe Turner wrote: > I'm having an issue with NSPropertyListSerialization, where I will call > dataWithPropertyList:format:options:error:, to get the data from a property > list–this part goes fine. However, then I need the data as a string, so I can > upload it

Re: loading French strings being in English language

2010-07-22 Thread Giacomo Tufano
Il giorno 22/lug/2010, alle ore 11.15, cocoa learner ha scritto: > I have localized my app in English and French languages. > But I want to load French strings being in English language based on radio > button input (English and French). > > Is it possible? > Is there any cocoa way of doing this?

Drag'n Drop Mail.app message to Cocoa app

2010-07-22 Thread John Ackert
Hi, how can I accept a dragged message from Mail.app into a NSTableView and how can I read the message's content? I receive the message URL in form of message: when I use NSURLPboardType as in the following example. - (void)awakeFromNib { [tableView registerForDraggedTypes:[NSArray arr

NSWindow and setLevel

2010-07-22 Thread Aragao, Andre Augusto de (Andre)
Hi, I have a requirement to have the main window for a certain application to stay on top of all other windows. What I found out is that if I use anything higher than kCGNormalWindowLevel for the NSWindow level, I achieve the expected result (for instance: kCGFloatingWindowLevel). However, Spaces

Re: NSWindow and setLevel

2010-07-22 Thread Seth Willits
On Jul 22, 2010, at 12:29 PM, Aragao, Andre Augusto de (Andre) wrote: > I have a requirement to have the main window for a certain application > to stay on top of all other windows. What I found out is that if I use > anything higher than kCGNormalWindowLevel for the NSWindow level, I > achieve t