IB Plugin - optionDescriptionsForBinding: not called

2009-05-27 Thread Yvan BARTHÉLEMY
Hello, I have tried to create a custom IB Plugin to support custom bindings/ reimplement existing bindings on NSImageView. My final goal is to have read/write access to path and url bindings, I intend to reimplement drag & drop and create files on the fly to achieve this. For this I tried

Abstract class with single subclass

2009-05-27 Thread Freddie Tilley
If I would want to allocate a class which allocates a single subclass instead, to hide the class implementation details would this be the correct way of doing it? The following code would be in the BaseClass + (id)allocWithZone:(NSZone*)aZone { if ([[self class] isEqualTo:[BaseClass c

NSString initWithFormat and stringWith

2009-05-27 Thread Ignacio Enriquez
Hi. I have a basic question regarding Class methods and instance methods and memory allocation. (this is in iPhone OS 3.0 beta 5) 1.- What is the difference between string1 and string2? where NSString *string1 = [NSString stringWithFormat:@"myFirstString"]; NSString *string2 = [[NSString alloc] in

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Jesper Storm Bache
On May 27, 2009, at 6:59 AM, Ignacio Enriquez wrote: Hi. I have a basic question regarding Class methods and instance methods and memory allocation. (this is in iPhone OS 3.0 beta 5) 1.- What is the difference between string1 and string2? where NSString *string1 = [NSString stringWithFormat:@"my

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Graham Cox
On 27/05/2009, at 11:59 PM, Ignacio Enriquez wrote: I have a basic question regarding Class methods and instance methods and memory allocation. (this is in iPhone OS 3.0 beta 5) 1.- What is the difference between string1 and string2? where NSString *string1 = [NSString stringWithFormat:@"myFir

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Dave DeLong
Hi Ignacio, I just ran a simple test, pasted below: NSString * one = [NSString stringWithString:@"Hello"]; NSString * two = [[NSString alloc] initWithString:@"Hello"]; NSLog(@"%X, %X, %X", one, two, @"Hello"); What you see logged is that the three strings point to the sa

Re: Abstract class with single subclass

2009-05-27 Thread Michael Ash
On Wed, May 27, 2009 at 9:48 AM, Freddie Tilley wrote: > If I would want to allocate a class which allocates a single subclass > instead, to > hide the class implementation details > > would this be the correct way of doing it? > > The following code would be in the BaseClass > > + (id)allocWithZo

Re: Abstract class with single subclass

2009-05-27 Thread Michael Ash
On Wed, May 27, 2009 at 9:48 AM, Freddie Tilley wrote: > If I would want to allocate a class which allocates a single subclass > instead, to > hide the class implementation details > > would this be the correct way of doing it? > > The following code would be in the BaseClass > > + (id)allocWithZo

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Erik Buck
Don't ever write either of the following lines: > NSString *string1 = [NSString stringWithFormat:@"myFirstString"]; > NSString *string2 = [[NSString alloc] initWithFormat:@"mySecondString"]; the WithFormat methods parse the argument string. If your argument string contains any '%' character

Re: Abstract class with single subclass

2009-05-27 Thread Freddie Tilley
On 27 mei 2009, at 16:51, Michael Ash wrote: On Wed, May 27, 2009 at 9:48 AM, Freddie Tilley wrote: If I would want to allocate a class which allocates a single subclass instead, to hide the class implementation details would this be the correct way of doing it? The following code would be

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Sherm Pendley
On Wed, May 27, 2009 at 9:59 AM, Ignacio Enriquez wrote: > > 1.- What is the difference between string1 and string2? where > NSString *string1 = [NSString stringWithFormat:@"myFirstString"]; > NSString *string2 = [[NSString alloc] initWithFormat:@"mySecondString"]; You own string2 and must rele

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Ignacio Enriquez
First: I just realized that one of my statements was incorrect; NSString *string2 = [[NSString alloc] initWithFormat:@"mySecondString"]; does not make string2 retainCount to be 2147483647, it only becomes 2147483647 when inserting @"" instead of @"mySecondString" And regarding why use retainC

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Bill Bumgarner
On May 27, 2009, at 8:34 AM, Ignacio Enriquez wrote: And regarding why use retainCount? Well I am trying to find where is my mistake, since sometimes my application crashes and I am quite (99.9%) sure that I am releasing a object that shouldn't be. Using -retainCount won't help you; a temptin

UITableView data source/delegate flow of control

2009-05-27 Thread WT
Hello... So, in order to better understand the flow of control when accessing a UITableView instance, I created a tiny project with a single section, having a single row, and then implemented every one of the 29 data source and delegate methods to do trivial things in addition to printing

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Michael Ash
On Wed, May 27, 2009 at 11:05 AM, Erik Buck wrote: > As an alternative, use > NSString *string1 = [[NSString stringWithString:@"myFirstString"] retain]; > or NSString *string2 = [[NSString alloc] initWithString:@"mySecondString"]; > or NSString *string3 = [@"myThirdString" copy]; However you shou

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Ignacio Enriquez
Thanks to all! NSZombiesEnabled YES Is really helpfull, now I now where to start!;) I wish I would have known this before. Cheers On Thu, May 28, 2009 at 12:38 AM, Bill Bumgarner wrote: > On May 27, 2009, at 8:34 AM, Ignacio Enriquez wrote: >> >> And regarding why use retainCount? >> Well I am

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Alex Curylo
On 27-May-09, at 8:41 AM, cocoa-dev-requ...@lists.apple.com wrote: Well I am trying to find where is my mistake, since sometimes my application crashes and I am quite (99.9%) sure that I am releasing a object that shouldn't be. Any ideas how to find such a bug? As long as the crashes happen

NSURLConnection sendSynchronousRequest and NSString stringWithContentsOfURL crashing under 10.5.7

2009-05-27 Thread Dennis Hartigan-O'Connor
I have a little app that downloads stock prices and was working perfectly (for years) until my recent upgrade to 10.5.7. After the upgrade, the program would crash on this call: NSString *currinfo = [NSString stringWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://fin

Field Editor Size in NSTableView

2009-05-27 Thread Timothy Larkin
I have an NSTableView that has rows of variable height, depending on the amount of text in a specific column. This works. If I resize the column, the row height adjusts correctly as the text is rewrapped. If I edit the contents of a cell, the field editor appears having the expected size.

NSTextFieldCell Delegate?

2009-05-27 Thread Walker Argendeli
I have a text field cell in a table view, from which I need to be made aware when it ends editing. I thought I would set my Controller class as the text field cell's delegate, and then use NSTextField's delegate method textDidEndEditing:, but realized that the text field cell doesn't seem

NSTextFieldCell Delegate?

2009-05-27 Thread Greg Guerin
Walker Argendeli wrote: I have a text field cell in a table view, from which I need to be made aware when it ends editing. I thought I would set my Controller class as the text field cell's delegate, and then use NSTextField's delegate method textDidEndEditing:, but realized that the text

Re: Bound NSPopUpButton + null at the beginning

2009-05-27 Thread Stamenkovic Florijan
On May 26, 2009, at 16:55, Stamenkovic Florijan wrote: Hi all, I am trying to figure out how to properly accomplish the following, and after reading docs, references and googling, I am still stuck. Any help appreciated: 1. Have an NSPopUp, "Contents" and "Content values" bound to an N

Traversing an NSXML subtree

2009-05-27 Thread McLaughlin, Michael P.
In reviewing the NSXML documents, I found no really simple way to traverse a subtree of an NSXMLDocument. That is, traverse from the root until you hit the node with the right name then pretend that that node is the root of a smaller tree and traverse just the latter. [Everything I found talked o

Re: Using fmdb with Cocoa Bindings

2009-05-27 Thread Kelvin Chung
On May 27, 2009, at 11:06 AM, Bill Garrison wrote: On May 27, 2009, at 1:33 AM, Kelvin Chung wrote: I'm fairly new to both fmdb and Cocoa bindings, so I am wondering if anyone can help me out: Suppose I have an FMResultSet resulting in a query. I'm trying to put the results in an NSTab

stripping question

2009-05-27 Thread Eric Slosser
I use 'strip -i -s savedSyms.txt my.app/Contents/MacOS/my' to remove symbols that aren't necessary. savedSyms.txt used to only contain typeinfo symbols (start with "__ZTI") that are necessary for cross-library exception catching to work. But today, I discovered the need to preserve ".ob

Re: Core data, bindings and multiple view NIB

2009-05-27 Thread Keary Suska
On May 27, 2009, at 12:30 AM, Tomaž Kragelj wrote: GroupItemsController: - managed object context -> Application.delegate.managedObjectContext - ??? The question marks are what I'm missing - if I don't bind to anything, then the array controller will simply show all items for all groups, how

Re: Abstract class with single subclass

2009-05-27 Thread Seth Willits
On May 27, 2009, at 7:51 AM, Michael Ash wrote: if ([[self class] isEqualTo:[BaseClass class]]) Oops, I forgot to mention one other thing. This works but is excessively wordy and strange. In a class method, [self class] is equivalent to self. Actually, I accidently used [self class] i

Re: NSTextFieldCell Delegate?

2009-05-27 Thread Shlok Datye
You could set a delegate for the NSTableView itself. In that delegate, you would implement the - (void)controlTextDidEndEditing:(NSNotification *)note delegate method. Within that method, you should be able to get the information you need. For example, NSTableView *tableView = [note object

Re: Traversing an NSXML subtree

2009-05-27 Thread Keith Duncan
Could someone clue me in as to the preferred method to do a subtraversal? Have you looked at XPath, it will save you from having to enumerate and perform element-name string comparisons. Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com

Re: Abstract class with single subclass

2009-05-27 Thread Dave Keck
> Actually, I accidently used [self class] in a class method two weeks ago, > and it was causing a crash. I forget the circumstances, but when I caught > that I was using [self class] and changed it to self, everything worked > fine. So I don't know what the difference is, but there apparently is a

Re: Traversing an NSXML subtree

2009-05-27 Thread Greg Guerin
McLaughlin, Michael P.: In reviewing the NSXML documents, I found no really simple way to traverse a subtree of an NSXMLDocument. That is, traverse from the root until you hit the node with the right name then pretend that that node is the root of a smaller tree and traverse just the latte

Bindings and core data

2009-05-27 Thread Michael Süssner
Hi I am experimenting with core data and bindings. I have a core data table with a one to-many relationship named "participants" I have in the same view another table displaying a list of participants. I want to add additional participants using a Popuplist with contacts and a participant

Re: Abstract class with single subclass

2009-05-27 Thread Seth Willits
On May 27, 2009, at 2:15 PM, Dave Keck wrote: Actually, I accidently used [self class] in a class method two weeks ago, and it was causing a crash. I forget the circumstances, but when I caught that I was using [self class] and changed it to self, everything worked fine. So I don't know wh

workaround: stubborn text attributes in NSTextView

2009-05-27 Thread Andy Lee
I had a problem with NSTextView refusing to use the text attributes I assigned to it. Here's my workaround in case anyone else runs into the same problem. I configured an NSTextView in IB with a custom text color, a bit of dummy text with a custom font, and rich text turned off (i.e., it's plai

Re: workaround: stubborn text attributes in NSTextView

2009-05-27 Thread Kyle Sluder
On Wed, May 27, 2009 at 2:58 PM, Andy Lee wrote: > I configured an NSTextView in IB with a custom text color, a bit of dummy > text with a custom font, and rich text turned off (i.e., it's plain text).   > The problem was that when the user deletes all the text, the text view > reverts to black

Re: Traversing an NSXML subtree

2009-05-27 Thread Kyle Sluder
On Wed, May 27, 2009 at 2:16 PM, Greg Guerin wrote: > Recursion: Be careful if you're processing arbitrary XML documents; you only have 8MB of stack to work with by default, and each stack frame adds up quickly. You might need to turn your recursive solution into an iterative one. --Kyle Sluder

Re: stripping question

2009-05-27 Thread Kyle Sluder
On Wed, May 27, 2009 at 1:35 PM, Eric Slosser wrote: > Why is this symbol required to launch? Does MyController have an +initialize method, or does any other class's +initialize method possibly create an instance of or call a class method of MyController? --Kyle Sluder __

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Andy Lee
On Wednesday, May 27, 2009, at 11:48AM, "Michael Ash" wrote: >This may seem nitpicky but I see a lot of newbies writing code just >like this. Their code is filled with stringWithString: calls for >absolutely no purpose, so I want to discourage that sort of thing. Just for grins, I searched for c

Re: workaround: stubborn text attributes in NSTextView

2009-05-27 Thread Andy Lee
On Wednesday, May 27, 2009, at 06:34PM, "Kyle Sluder" wrote: >On Wed, May 27, 2009 at 2:58 PM, Andy Lee wrote: >> I configured an NSTextView in IB with a custom text color, a bit of dummy >> text with a custom font, and rich text turned off (i.e., it's plain text).   >> The problem was that whe

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Jesper Storm Bache
Assuming that NSString may be using CFStrings, then the issue may be related to const strings. See information regarding "OTHER_CFLAGS = -fno-constant-cfstrings" The basic issue is that when constant cfstrings is enabled, then the string may be put into the TEXT segment and you end up passing

Re: Bindings and core data

2009-05-27 Thread Shlok Datye
The reason why IB complains is that the dot accessor only returns a regular set. You should therefore use "IBOutlet NSSet *selParticipants" instead. For the same reason, you cannot add a participant to selection.participants using addObjects. Instead, you should either (1) use mutableSetV

Re: Field Editor Size in NSTableView

2009-05-27 Thread Graham Cox
On 28/05/2009, at 4:15 AM, Timothy Larkin wrote: Resizing the column makes everything good again. So there must be some property of the field editor that can be modified so that it follows the row height. Presumably this could be changed without resizing the column. But hours of search and

Re: Field Editor Size in NSTableView

2009-05-27 Thread Timothy Larkin
Tried that. The field editor does vertically resize, but only if I change the column width. It just doesn't vertically resize in response to changes in the row height. -- Timothy Larkin Abstract Tools Caroline, NY On May 27, 2009, at 7:32 PM, Graham Cox wrote: Have you tried [textEditor set

Fixing logged error that doesn't throw exception

2009-05-27 Thread Graham Cox
I'm getting this in the log when I open the "Customize Toolbar" sheet: -[NSConcreteAttributedString initWithString:] called with nil string argument. This has undefined behavior and will raise an exception in post-Leopard linked apps. This warning is displayed only once. Is this a bug in th

Re: Fixing logged error that doesn't throw exception

2009-05-27 Thread Jonathan Hess
The technique I typically use to debug these types of log messages is a breakpoint on NSLog. If that isn't hit, you could try a breakpoint on write. After you hit the breakpoint, verify that it's for the log message you're trying to debug, and then use the backtrace to get an idea of what e

NSValueTransformer/Cocoa Bindings question

2009-05-27 Thread Kelvin Chung
I'm having trouble using an NSValueTransformer. Suppose I have an NSArrayController foo. If I bind a label's value to selection.number (which is an NSNumber) on foo, then this is fine. However, I'm having trouble when it comes to transforming this value. Suppose I have a second NSArrayCo

Wacky Text View Glyph Rending Bug

2009-05-27 Thread Seth Willits
http://www.sethwillits.com/temp/TextViewGlyphBug.mov I have a custom text storage object, and I assume that's at the core of this issue, but I'm not sure what's going on. Any ideas? -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.app

Re: NSURLConnection sendSynchronousRequest: crashes since, upgrading to 10.5.7

2009-05-27 Thread Dennis Hartigan-O'Connor
I have a very similar problem: my simple program that downloads stock prices has been working fine but intermittently crashes on 10.5.7, whether I use sendSynchronousRequest or stringWithContentsOfURL. For me, too, everything is fine for 10-15 minutes and then the program crashes. Here is the

Re: Wacky Text View Glyph Rending Bug

2009-05-27 Thread Aki Inoue
Looks like the glyph info stored in NSLayoutManager is out of sync. Are you calling -edited:range:changeInLength: from your implementation of attribute modifying methods ? Aki On 2009/05/27, at 18:19, Seth Willits wrote: http://www.sethwillits.com/temp/TextViewGlyphBug.mov I have a custo

Re: Fixing logged error that doesn't throw exception

2009-05-27 Thread Ken Thomases
On May 27, 2009, at 7:15 PM, Graham Cox wrote: I'm getting this in the log when I open the "Customize Toolbar" sheet: -[NSConcreteAttributedString initWithString:] called with nil string argument. This has undefined behavior and will raise an exception in post-Leopard linked apps. This warn

Re: Abstract class with single subclass

2009-05-27 Thread Michael Ash
On Wed, May 27, 2009 at 5:37 PM, Seth Willits wrote: > I know this isn't exactly a very detailed description, but if they were > equivalent, then changing [self class] to self shouldn't have fixed it, but > it did. Pretty weird. Does not follow. It's quite common in C-based languages to have brok

Re: Fixing logged error that doesn't throw exception

2009-05-27 Thread Graham Cox
On 28/05/2009, at 11:40 AM, Ken Thomases wrote: On May 27, 2009, at 7:15 PM, Graham Cox wrote: I'm getting this in the log when I open the "Customize Toolbar" sheet: -[NSConcreteAttributedString initWithString:] called with nil string argument. This has undefined behavior and will raise

Re: stripping question

2009-05-27 Thread Eric Slosser
On May 27, 2009, at 6:39 PM, Kyle Sluder wrote: On Wed, May 27, 2009 at 1:35 PM, Eric Slosser fx.com> wrote: Why is this symbol required to launch? Does MyController have an +initialize method, No. or does any other class's +initialize method possibly create an instance of or call a class

Re: Fixing logged error that doesn't throw exception

2009-05-27 Thread Dave Keck
I see this error at least several times a week. Searching through this week's logs from my work computer: ibtool[6341]: -[NSConcreteAttributedString initWithString:] called with nil string argument... mdworker[422]: -[NSConcreteAttributedString initWithString:] called with nil string argument...

Re: Fixing logged error that doesn't throw exception [SOLVED]

2009-05-27 Thread Graham Cox
On 28/05/2009, at 12:04 PM, Graham Cox wrote: The only field I have in the toolbar is a search field - looks entirely standard as far as I can see. #0 0x93d221e6 in -[NSConcreteAttributedString initWithString:] #1 0x93d220eb in -[NSConcreteAttributedString initWithString:attributes:]

Re: Wacky Text View Glyph Rending Bug

2009-05-27 Thread Seth Willits
So I just stripped the entire project down to 60 lines of code and it was still happening. I was JUST about to click send and then I re-read your message, and it turns out I forgot to call - edited:range:changeInLength: from within -setAttributes:range: Added that one line and all is good

How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Jerry Krinock
How can I determine if a given file path, or a file alias (I have both), refers to an item which is in the Trash? The obvious answer, using -[NSString hasPrefix:] on the path with NSHomeDirectory()/.Trash, doesn't look very pretty. Thanks, Jerry

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Andy Lee
I just noticed an earlier message in this thread that points out that stringWithString: does in fact do the same optimization as -copy for constant strings. So the approach in Apple's sample code does not protect from the bundle unloading problem. Aside from the OTHER_CFLAGS approach Jesp

Re: How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Kiel Gillard
Nothing comes to mind from the top of my head. A little digging through Carbon documentation suggested you could use FSCatalogInfo() function to determine the parent directory ID of the file you are testing. With the result of that function, you can use the IdentifyFolder() function to see

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Bill Bumgarner
On May 27, 2009, at 8:20 PM, Andy Lee wrote: I just noticed an earlier message in this thread that points out that stringWithString: does in fact do the same optimization as - copy for constant strings. So the approach in Apple's sample code does not protect from the bundle unloading problem

Re: [NSApp presentError:error] & Custom Icon ...

2009-05-27 Thread Jerry Krinock
On 2009 May 19, at 07:53, Mic Pringle wrote: Is it possible to use an icon other than the applications when using [NSApp presentError:error] ? Override -willPresentError: like this: - (NSError *)willPresentError:(NSError *)error_ { // Present the error yourself ... [beginSheet..., sh

Re: Core data, bindings and multiple view NIB

2009-05-27 Thread Tomaž Kragelj
Thanks Keary, this works, however it requires that the same binding is repeated in each nib where the same list should be handled (some views may only need to show it while others can also modify it). I was thinking of creating a "master" set of controllers in the main nib, then bind the "s

Re: How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Adam R. Maxwell
On May 27, 2009, at 8:05 PM, Jerry Krinock wrote: How can I determine if a given file path, or a file alias (I have both), refers to an item which is in the Trash? The obvious answer, using -[NSString hasPrefix:] on the path with NSHomeDirectory()/.Trash, doesn't look very pretty. Check t

Creating, Constructing and Managing Dynamic (Sub)Views

2009-05-27 Thread Grant Erickson
I have a set of, let's say three, devices that have a range features among them: a common, base feature set and then some combination of A, B or A + B on top of that common base. When the user is managing and configuring these devices from a list (a table view for example), I bring up a dialog box

Re: How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Jerry Krinock
Thanks, Kiel and Adam. FSDetermineIfRefIsEnclosedByFolder() has the advantage over IdentifyFolder(parent) of working for items that are buried in folders that are in the trash, but strangely it gives a -35 nsvErr "no such volume" error if the item is not in the trash. I just ignore all th

Re: How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Kyle Sluder
On Wed, May 27, 2009 at 10:04 PM, Jerry Krinock wrote: > At first I thought these FS functions were in Carbon, but the docs say that > they are in CoreServices, so I guess this is OK for the 64-bit future. The only parts of Carbon that are deprecated are the GUI aspects. While it makes sense to a

Programmatically displaying NSStatusItem's menu

2009-05-27 Thread Adam Warski
Hello, I have a simple NSStatusItem with a menu (no custom views), just using text as the title. When I click on it, everything displays fine, however now I would like to display it programmatically - in other words, simulate a mouse click on the status item's text. Currently I'm invoking "

Re: Creating, Constructing and Managing Dynamic (Sub)Views

2009-05-27 Thread Graham Cox
On 28/05/2009, at 2:34 PM, Grant Erickson wrote: is it best to have a NIB for each subview or pack them all into a single NIB? I'd say put all the subviews into the same nib. It makes it much easier to select among them because you can have a single master controller that has outlets for

Booleans

2009-05-27 Thread John Ku
I am trying to set an object's boolean, everything works but I get a warning of 'pointer from integer without a cast'. *// Here is the Main Class:* [theObject setActivated: YES]; *// Here is the Object Class:* @property(readwrite, assign) BOOL *activated; @synthesize activated; - (void)

Re: Booleans

2009-05-27 Thread Roland King
BOOL isn't an object. you want BOOL not BOOL* John Ku wrote: I am trying to set an object's boolean, everything works but I get a warning of 'pointer from integer without a cast'. *// Here is the Main Class:* [theObject setActivated: YES]; *// Here is the Object Class:* @property(read

Re: Booleans

2009-05-27 Thread John Ku
Thank you all, a newb mistake. :PIm going crazy trying to put pointer on everything. Btw, BOOL is not, is Boolean a pointer type? Thanks! On Wed, May 27, 2009 at 11:46 PM, Roland King wrote: > BOOL isn't an object. you want BOOL not BOOL* > > John Ku wrote: > >> I am trying to set an object's