Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Oleg Krupnov
target/action Is this the same as the following? action is sent to target on a click. The other things you mention are either not detected or not sent on to the target. I don't quite understand how target/action works under the hood. If I were an implementor of NSButton, how would I declare

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Graham Cox
On 24 Jul 2008, at 3:58 pm, Oleg Krupnov wrote: target/action Is this the same as the following? action is sent to target on a click. The other things you mention are either not detected or not sent on to the target. I don't quite understand how target/action works under the hood. If I

Re: Help on Menu Item

2008-07-24 Thread Andrew Merenbach
Would a system Service be what you're after? These appear under the application menu Services. Other than that, I know of no supported way to insert an item into a menu in every program -- although you might also try an NSStatusItem. Note, however, that with that solution, the docs

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Oleg Krupnov
On Thu, Jul 24, 2008 at 9:15 AM, Graham Cox [EMAIL PROTECTED] wrote: On 24 Jul 2008, at 3:58 pm, Oleg Krupnov wrote: Currently the Sent Actions section does not even appear in my custom view's connections menu at all, how would I make it appear? To clarify: the reason it's not listed is

[MEET] CocoaHeads: Silicon Valley DATE CHANGED

2008-07-24 Thread Stephen Zyszkiewicz
Mac Developers, The CocoaHeads: Silicon Valley meeting tomorrow has been canceled. We may have a meeting next week on the 31st. Please be sure to check the web site beforehand to be sure. Steve http://cocoaheads.org ___ Cocoa-dev mailing list

Re: Is checking -count worth it?

2008-07-24 Thread Jens Alfke
On 23 Jul '08, at 9:15 PM, Steve Cronin wrote: Is this code worth it? if ([M count]0) [M removeObject:O]; OR should I just do [M remove O]; No, the first line is not worth it. You've added an extra message-send (which is _not_ cheap) to pre-check something that the NSArray (really

Re: Help on Menu Item

2008-07-24 Thread Jens Alfke
On 23 Jul '08, at 10:19 PM, Adil Saleem wrote: Hi,Is it possible to make a program that appears as a menu item for all applications ? Actually i want to make a custom action which i want to appear in every application's menu (just like About, Quit etc...) or it can just appear in the

Re: Is checking -count worth it?

2008-07-24 Thread Matthew Schinckel
On 24/07/2008, at 4:12 PM, Jens Alfke wrote: On 23 Jul '08, at 9:15 PM, Steve Cronin wrote: Is this code worth it? if ([M count]0) [M removeObject:O]; OR should I just do [M remove O]; No, the first line is not worth it. You've added an extra message- send (which is _not_ cheap) to

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Chris Hanson
On Jul 23, 2008, at 11:28 PM, Oleg Krupnov wrote: Notifications is another point of confusion for me. I would assume that notifications should be used when multiple observers can be connected to an event exposed by an object, in contrast to a simple delegate outlet, which can only have one

Re: Is checking -count worth it?

2008-07-24 Thread Ken Thomases
On Jul 24, 2008, at 2:02 AM, Matthew Schinckel wrote: Am I better off in general (ie, adding objects, removing objects, etc) using an NS(Mutable)Set instead of an NSArray, if I don't need sorting and duplicate items? Since the semantics of an NSSet are looser than those for an NSArray

Re: Help on Menu Item

2008-07-24 Thread Adil Saleem
Ok, an item in services menu or a status item will serve my purpose. But i have no idea how to make a service or a status item. Can you please point me to some tutorial or document for that ?   Thank you       --- On Wed, 7/23/08, Jens Alfke [EMAIL PROTECTED] wrote: From: Jens Alfke [EMAIL

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Oleg Krupnov
Notifications is another point of confusion for me. I would assume that notifications should be used when multiple observers can be connected to an event exposed by an object, in contrast to a simple delegate outlet, which can only have one connected object. Am I correct? They're really for

Re: Help on Menu Item

2008-07-24 Thread Tim Isted
Apple docs on Status Bars are at: http://developer.apple.com/documentation/Cocoa/Conceptual/StatusBar/StatusBar.html There's a MacTech article with walk-thru information here: http://www.mactech.com/articles/mactech/Vol.22/22.02/Menulet/ Tim On 24 Jul 2008, at 10:46, Adil Saleem

NSNumber negative or positive in TableView?

2008-07-24 Thread Trygve Inda
I have a tableView with one column containing an NSNumber. This tableView is bound to an array and an arrayController is used as well. In the case of the unsigned NSNumber 2481864868 (signed -1813102428)... Sometimes when I load my array from the plist it shows up as the positive value, and

Folder has limited permissions.

2008-07-24 Thread Macarov Anatoli
HI! Cocoa, Obj-c. How to creat a file in the folder that has limited permissions (read-only)? Give me example, please. Вы уже с Yahoo!? Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.com

Re: Folder has limited permissions.

2008-07-24 Thread Jean-Daniel Dupas
Le 24 juil. 08 à 14:24, Macarov Anatoli a écrit : HI! Cocoa, Obj-c. How to creat a file in the folder that has limited permissions (read- only)? Give me example, please. You can use NSTask and /usr/libexec/authopen (and pipes) See man authopen for details. If it's not enought, you have to

XML serialization and deserialization

2008-07-24 Thread Oleg Krupnov
Hi, I want to serialize and deserialize my objects to/from XML files. NOTE: My object is not a dictionary, so I am not using the plist. I have found NSXMLParser for event-driven parsing and I also found NSXMLDocument for tree-based parsing. However, I don't see anything to *serialize* my

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Erik Buck
Warning: Blatant self serving plug: Target/Action, Delegates, and Notifications are all software design patterns. They aren't even unique to Cocoa, but Cocoa has particularly elegant implementations. You can read/review all about these patterns and more including analysis of the

Re: Folder has limited permissions.

2008-07-24 Thread Macarov Anatoli
Someone has an example with authorization services.Le 24 juil. 08 à 14:24, Macarov Anatoli a écrit : HI! Cocoa, Obj-c. How to creat a file in the folder that has limited permissions (read- only)? Give me example, please. You can use NSTask and /usr/libexec/authopen (and pipes) See man

Fancy drag drop

2008-07-24 Thread Nicolas L.
HI all! I'm interested in the way Interface Builder, Instruments and probably a couple of other apps handle drag and drop. You know, how the item dragged from the Library panel changes depending where it's about to be dropped. I've subclassed my table views and overridden the methods to

Re: Folder has limited permissions.

2008-07-24 Thread Jean-Daniel Dupas
I think Apple has one, but to find it, you may have to try to search… http://developer.apple.com/samplecode/BetterAuthorizationSample/index.html Le 24 juil. 08 à 15:37, Macarov Anatoli a écrit : Someone has an example with authorization services.Le 24 juil. 08 à 14:24, Macarov Anatoli a

Re: Daemon Advice?

2008-07-24 Thread Karl Moskowski
On 23 Jul '08, at 2:20 PM, Nick Zitzmann wrote: Calling ObjC methods in a signal handler is not a good idea: http://lists.apple.com/archives/Cocoa-dev/2001/Dec/msg00159.html I didn't find that during my searches. Good to know. I'll remove all the Cocoa stuff from the handler. Thanks, Nick.

Issue sorting an NSTableView

2008-07-24 Thread Timothy Reaves
The documentation for NSTableView setSortDescriptors: starts off with A table column is considered sortable if it has a sort descriptor that specifies the sorting . I find this a bit puzzling as this is the documentation for NSTableView, not NSTableColumn. What is the correct

Re: Issue sorting an NSTableView

2008-07-24 Thread Corbin Dunn
On Jul 24, 2008, at 8:48 AM, Timothy Reaves wrote: The documentation for NSTableView setSortDescriptors: starts off with A table column is considered sortable if it has a sort descriptor that specifies the sorting . I find this a bit puzzling as this is the documentation for

Re: Folder has limited permissions.

2008-07-24 Thread Todd Heberlein
http://developer.apple.com/samplecode/BetterAuthorizationSample/index.html From the page: This involves putting the privileged code into a small, privileged helper tool that is run by launchd. Argh! Since MacOS 10.4 all processes that are spawned from launchd (and their children) are

Re: Folder has limited permissions.

2008-07-24 Thread Kyle Sluder
On Thu, Jul 24, 2008 at 12:46 PM, Todd Heberlein [EMAIL PROTECTED] wrote: Argh! Since MacOS 10.4 all processes that are spawned from launchd (and their children) are *not* audited by Mac's audit system (BSM). Well it would certainly have been a feat for them to audit launchd jobs in 10.3! :D

NSURLConnection crash

2008-07-24 Thread Sijmen Mulder
I'm experiencing strange crashes with NSURLConnection (EXC_BAD_ACCESS). As far as I know, I'm doing nothing strange. I set up the request, pass it to a connection, and let it start. Then, after a second or two, the crash comes. Note that I'm using garbage collection. I've narrowed it down

Re: Folder has limited permissions.

2008-07-24 Thread Todd Heberlein
Well it would certainly have been a feat for them to audit launchd jobs in 10.3! :D Speaking of which, can you provide a reference? This is more than mildly intriguing to me. I filed a bug report for this about a year ago for 10.4, but I discovered it when someone complained that access to

Re: NSLog on releasebuild

2008-07-24 Thread Nate Weaver
You're right, of course (I forgot about this). I think I decided not to worry about it too much since it shouldn't make it into production code (if it does, then I did something wrong). My main goal was to keep the macro as simple as I could (or at least, not have to break it onto multiple

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread mmalc crawford
On Jul 23, 2008, at 10:51 PM, Graham Cox wrote: 2) I have found that IB automatically treats all member variables of my custom view's class that are of type id or id... as outlets, i.e. they appear in the list of outlets on Ctrl+click. This is not always desirable. How do I prevent some of

Re: Is checking -count worth it?

2008-07-24 Thread Jens Alfke
On 24 Jul '08, at 12:02 AM, Matthew Schinckel wrote: Am I better off in general (ie, adding objects, removing objects, etc) using an NS(Mutable)Set instead of an NSArray, if I don't need sorting and duplicate items? As always, it depends. For the most part, sets are faster because

Newb Question re Messaging and Return Values

2008-07-24 Thread Brad Gibbs
I'm having a hard time understanding return values and maybe messaging in general. I've looked through Programming in Objective-C, Hillegass Third Edition and through Apple's documentation, but don't seem to know enough to find the answer or a proper example I can implement. I have a view

Re: NSURLConnection crash

2008-07-24 Thread Jeff Johnson
Sijmen, It seems to be the call to [connection start] that's causing the crash. The call to [[NSURLConnection alloc] initWithRequest:request delegate:self] already starts it loading, so there's no need to call start. I don't think it should crash -- that may be an Apple bug -- but it

Core Data Backup on App Start

2008-07-24 Thread Garrett Bjerkhoel
I have a boolean set for my preferences to check whether the user wants to backup the database at each start. My only question is how should I do it? I already log whether they want it or not, so I have got that far. Should I read the contents of my backup file? How could I find that

Replacement for openUntitledDocumentOfType:display:

2008-07-24 Thread James Bucanek
This question has been asked, but never answered. I'm cleaning up a project and removing methods deprecated in 10.4. The method - (id)openUntitledDcumentOfType:(NSString*)docType display:(BOOL)display was deprecated in 10.4. It says to use openUntitledDocumentAndDisplay:error: instead.

Re: XML serialization and deserialization

2008-07-24 Thread Ken Thomases
On Jul 24, 2008, at 8:20 AM, Oleg Krupnov wrote: I want to serialize and deserialize my objects to/from XML files. Have you read this: http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/index.html ? Cheers, Ken ___ Cocoa-dev

Re: Folder has limited permissions.

2008-07-24 Thread Ken Thomases
On Jul 24, 2008, at 7:24 AM, Macarov Anatoli wrote: Cocoa, Obj-c. How to creat a file in the folder that has limited permissions (read- only)? This is ambiguous. Do you mean there is a folder to which the user does not have write permissions and you want to create a file within it? If

Re: Replacement for openUntitledDocumentOfType:display:

2008-07-24 Thread Kyle Sluder
On Thu, Jul 24, 2008 at 2:42 PM, James Bucanek [EMAIL PROTECTED] wrote: What's the 10.4/10.5 equivalent method for creating a new document of a specific type? The docs say to use -makeUntitledDocumentOfType:error: and -addDocument. All -openUntitledDocumentAndDisplay:error: does is fill in the

Re: NSURLConnection crash

2008-07-24 Thread Sijmen Mulder
Thanks! That's solved it. Submitted as #6100263, just in case. Op 24 jul 2008, om 20:10 heeft Jeff Johnson het volgende geschreven: Sijmen, It seems to be the call to [connection start] that's causing the crash. The call to [[NSURLConnection alloc] initWithRequest:request delegate:self]

Re: Core Data Backup on App Start

2008-07-24 Thread Kyle Sluder
On Thu, Jul 24, 2008 at 2:37 PM, Garrett Bjerkhoel [EMAIL PROTECTED] wrote: I have a boolean set for my preferences to check whether the user wants to backup the database at each start. My only question is how should I do it? I already log whether they want it or not, so I have got that far.

Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Chris Hanson
On Jul 24, 2008, at 4:10 AM, Oleg Krupnov wrote: Notifications is another point of confusion for me. I would assume that notifications should be used when multiple observers can be connected to an event exposed by an object, in contrast to a simple delegate outlet, which can only have one

Re: Daemon Advice?

2008-07-24 Thread Chris Hanson
On Jul 23, 2008, at 1:09 PM, Karl Moskowski wrote: I'm working on a Foundation tool to be used as a launchd daemon. It's a Leopard-only GC app that uses FSEvents to watch for changed files. Can anyone offer any tips or guidance? Thanks. I have a couple other tips, since you're writing a

Cocoa Touch template not appearing.

2008-07-24 Thread David Parker
Hi, what needs to be done to have Cocoa Touch appear in XCode? The left -pane in the new project pane shows iPhone and Mac OS X sections. I click on Applications beneath iPhone and do not see it. One of the videos for iPhone shows it being there. thanks in advance.

Re: Core Data Backup on App Start

2008-07-24 Thread Marco Masser
I have a boolean set for my preferences to check whether the user wants to backup the database at each start. My only question is how should I do it? I already log whether they want it or not, so I have got that far. Should I read the contents of my backup file? How could I find that

Re: Daemon Advice?

2008-07-24 Thread Karl Moskowski
On 24-Jul-08, at 5:52 PM, Chris Hanson wrote: On Jul 23, 2008, at 1:09 PM, Karl Moskowski wrote: I'm working on a Foundation tool to be used as a launchd daemon. It's a Leopard-only GC app that uses FSEvents to watch for changed files. Can anyone offer any tips or guidance? Thanks. I

Re: Daemon Advice?

2008-07-24 Thread Jean-Daniel Dupas
Once through your run loop is also a good place to hint to the collector that it should collect if necessary. A non-GC app would probably bracket the run of the run loop in an autorelease pool. A decent technique for this is to get the underlying CFRunLoop from the NSRunLoop (they're

Re: Daemon Advice?

2008-07-24 Thread Karl Moskowski
On 24-Jul-08, at 6:28 PM, Jean-Daniel Dupas wrote: Once through your run loop is also a good place to hint to the collector that it should collect if necessary. A non-GC app would probably bracket the run of the run loop in an autorelease pool. A decent technique for this is to get

NSToolTipAttribute not written to pasteboard?

2008-07-24 Thread Philip Dow
Howdie, I'm playing around with the NSToolTipAttribute in attributed strings and I seem to be finding that the attribute is not written to the pasteboard when I cut/paste or drag text around in an NSTextView. Is this a known issue? Checking Google I discovered that back in 2004 it was

Re: Newb Question re Messaging and Return Values

2008-07-24 Thread Brad Gibbs
Looking at my problem further, I'm thinking I should make webServer a delegate of each of the devices. That would allow me to encapsulate the HTTP Posts and Gets for all of the devices in a single class. A device's methods could invoke the webServer delegate when they need to send

NSString sizeWithAttributes inaccuracy

2008-07-24 Thread Jacob Ole Juul Kolding
Hello List I'm working on an app where I have a NSTableView with one column containing strings. I want this column to automatically resize itself within the ScrollView to fit the width of the widest string. In order to do this I came up with the following code:

NSTableview datasource and NSPopupButtonCell

2008-07-24 Thread HAMILTON, Steven
Hi Folks, I have a NSTableview with a datasource consisting of an NSArray of dictionaries. One column in my table has an NSPopupbuttonCell. The content and contentValues are bound to a Core Data Account object. I use a name property as my contentValue. I'm having trouble changing

[Moderator] Re: Cocoa Touch template not appearing.

2008-07-24 Thread Scott Anguish
On 24-Jul-08, at 6:05 PM, David Parker wrote: Hi, what needs to be done to have Cocoa Touch appear in XCode? iPhone SDK -- Until an announcement is made otherwise, developers should be aware that the iPhone SDK is still under non-disclosure (section 5.3 of the iPhone Development

Re: how to correctly set knob/thumb proportion and scroller orientation in NSScroller

2008-07-24 Thread Rua Haszard Morris
Aha, that makes sense, pity it's not in the documentation I was referring to: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScroller_Class/Reference/Reference.html#/ /apple_ref/doc/uid/2340-1956 I'll fill in the feedback. (alas, I'll have to have a

Re: NSString sizeWithAttributes inaccuracy

2008-07-24 Thread Aki Inoue
Try using -boundingRectWithSize:options:attributes instead with NSStringDrawingUsesDeviceMetics. Aki On 2008/07/24, at 14:23, Jacob Ole Juul Kolding wrote: Hello List I'm working on an app where I have a NSTableView with one column containing strings. I want this column to automatically

Re: NSLog on releasebuild

2008-07-24 Thread Michael Ash
On Thu, Jul 24, 2008 at 1:35 PM, Nate Weaver [EMAIL PROTECTED] wrote: You're right, of course (I forgot about this). I think I decided not to worry about it too much since it shouldn't make it into production code (if it does, then I did something wrong). My main goal was to keep the macro as

NSTableView NSTrackingArea and mouse clicks

2008-07-24 Thread [EMAIL PROTECTED]
i have an NSTableView that uses a data source (no bindings, but i don't think this is relevant). one column uses a custom cell that is actually a subclass of NSTokenFieldCell (but i don't think this is relevant either). i draw this cell differently depending on whether or not the row it is in

Re: Fancy drag drop

2008-07-24 Thread Ron Lue-Sang
On Jul 24, 2008, at 8:20 AM, Nicolas L. wrote: HI all! I'm interested in the way Interface Builder, Instruments and probably a couple of other apps handle drag and drop. You know, how the item dragged from the Library panel changes depending where it's about to be dropped. I've

Drawing a drop-shadow around a view

2008-07-24 Thread Graham Cox
I have a view embedded in a NSScrollView. When the view is small there's a large expanse of grey visible. I'd like to draw a drop- shadow around the view in this situation to help it stand out slightly from the background. What's a good approach to do this? tia, cheers, Graham

Re: Cleaning up my Data Model

2008-07-24 Thread Ron Lue-Sang
Are you just trying to delete old array controllers that are in entity mode? You'll have to go through each array controller one by one and take a look at which entity they've been assigned. Once you delete the controllers, the bindings to those controllers will be deleted as well. So this

Re: linking NSArrayController and Undo manager

2008-07-24 Thread Ron Lue-Sang
On Jul 21, 2008, at 8:52 PM, Todd Heberlein wrote: Is there a way to link a controller (e.g., the NSArrayController) to my NSDocument's NSUndoManager without having to add a bunch of code to my NSDocument subclass? For example, in Hillegass's book, the first example of RaiseMan (Chap 8)

Correct way to commit pending text field edits?

2008-07-24 Thread Graham Cox
I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data model. If I have edited text in a field but not hit return or tab or anything else that triggers target/action, the edit is ignored. So I need a way to

Re: Fancy drag drop

2008-07-24 Thread Philip Dow
It's not trivial, but you want to create a transparent window and show it while simultaneously returning an empty image. Then in the draggedImage:movedTo method you can update the position of the window and depending on ui window element it is over, change the shape. ~Phil On Jul 24,

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Ken Ferry
Hi Graham, Try -[NSControl validateEditing]. Validation sets the object value of the cell to the current contents of the cell's editor (the NSText object used for editing), storing it as a simple NSString or an attributed string object based on the attributes of the editor. -Ken On Thu, Jul

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Graham Cox
I should mention I'm not using Core Data - by data model I mean my own d/m code. Mmmm, coffee... now there's a thought. Graham On 25 Jul 2008, at 12:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Apologies for the off-list reply, work email addy.. Try [managedObjectContext

[MEET] Singapore CocoaHeads TODAY (25 July 08)

2008-07-24 Thread Joe Goh
Hey everyone! Singapore CocoaHeads is being held today (25 Jul 08) from 7 - 9pm! Location: iShop #03-04 Orchard Cineleisure 8 Grange Road Proceed to training room 3, or just ask the shop floor staff about Singapore CocoaHeads and they'll direct you to where we're meeting. CocoaHeads is a group

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Joel Norvell
Graham Cox wrote: I need a way to commit ... pending edits as part of my response to the Apply button. I don't know that this is the correct way, but there is a built-in mechanism that will do what you want: If you were to makeFirstResponder nil for the window containing the text field,

Re: Correct way to commit pending text field edits?

2008-07-24 Thread chaitanya pandit
You need to call this on the NSTextField's cell: setSendsActionOnEndEditing:YES Hope it helps. -Chaitanya On 24-Jul-08, at 10:23 PM, Graham Cox wrote: I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Ken Thomases
On Jul 24, 2008, at 9:23 PM, Graham Cox wrote: I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data model. If I have edited text in a field but not hit return or tab or anything else that triggers

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Joel Norvell
chaitanya pandit wrote: You need to call this on the NSTextField's cell: setSendsActionOnEndEditing:YES sendsActionOnEndEditing appears to be ON by default. And it doesn't affect pending edits anyway. The problem is how to cause textDidEndEditing to fire. Hence my suggestion to

(no subject)

2008-07-24 Thread 松 李
I have a problem about ABAddressBook, i want get NSData with ABPerson' vCardRepresentation fuction,the NSData is vcard 3.0 formatter,but i want to get vcard 2.1 formatter, how to get vcard 2.1 formatter with vCardRepresentation, follow is my code : ABPerson* thePerson = [theArray