initWithCoder / unarchiveObjectWithData Memory Management Question

2010-02-19 Thread Thomas Wetmore
I have a memory management question involving the interaction of: - (id) initWithCoder: (NSCoder*) coder from any class that implements and + (id) unarchiveObjectWithData: (NSData*) data from the NSKeyedUnarchiver (or any unarchiver) class. After the following lines of code run ... NSData* d

Removing item from CollectionView by drag it out.

2010-02-19 Thread Sandro Noël
Greetings I've been looking at Collection View Drag and drop, I've implemented the NSCollectionViewDelegate and now I can Drop items in and everything works fine. I've been looking at removing items from the collection view by dragging them out of the frame. I'm confused by the proper procedur

NSPathStore2 HELP!!!!!!

2010-02-19 Thread livinginlosangeles
> > Subject: Re: NSPathStore2 HELP!! > > Ok, here is how I solved this. Before I called [NSKeyedUnarchive > unarchive...], I called the class method: > > [NSKeyedUnarchiver setClass:[NSString class] forClassName:@"NSPathStore2"]; > > This fixed the errors and allowed me to reclaim the data

Re: Monitoring other application preferences changes

2010-02-19 Thread Kyle Sluder
On Fri, Feb 19, 2010 at 5:57 PM, Jack Carbaugh wrote: > i would think you could use FSEvents to be informed of any changes to a > .plist file. You have no guarantee that this is how an application is storing its preferences. And for apps that do use this method, they might synchronize their prefe

Re: Monitoring other application preferences changes

2010-02-19 Thread Jack Carbaugh
i would think you could use FSEvents to be informed of any changes to a .plist file. On Feb 19, 2010, at 8:24 PM, Sandro Noël wrote: Greetings. I'm trying to figure out how to monitor the preferences changes in another application's preferences I would like my application to react to chang

Monitoring other application preferences changes

2010-02-19 Thread Sandro Noël
Greetings. I'm trying to figure out how to monitor the preferences changes in another application's preferences I would like my application to react to changes made in another application settings by the user. besides reloading the plist on a schedule is there a better way? ( I don't like this

Core Animation: What is a "trigger key"?

2010-02-19 Thread Jerry Krinock
In documentation of the protocol NSAnimatablePropertyContainer, -setAnimations: "Sets the option dictionary that maps event trigger keys to animation objects." What is a "trigger key"? I can't find any mention of "trigger key" in "Core Animation Programming Guide". Any relation to an "animatab

Re: Animating an Attached Window (was: Drawing Attention to a Control...)

2010-02-19 Thread Dave Keck
> [[self window] setAnimations:[NSDictionary dictionaryWithObject:[self > shakeAnimation:[[self window] frame]] forKey:@"frameOrigin"]]; > [[[self window] animator] setFrameOrigin:[[self window] frame].origin]; > > /* > >  shake animation >  http://www.cimgf.com/2008/02/27/core-animation-tutorial-

Re: How to detect if mouse on border of view

2010-02-19 Thread Quincey Morris
On Feb 19, 2010, at 13:36, Mazen M. Abdel-Rahman wrote: > Thanks everyone for your help on this. I wanted to know if the mouse was on > the border area prior to the mouse down event to determine if the mouse icon > should change as the mouse hovers over the border. Is there a way to do this

Re: NSTableView with PopUpButtonCell column with different content per row

2010-02-19 Thread Jerry Krinock
On 2010 Feb 19, at 13:30, Sean McBride wrote: > In my case currently, I need several separators and also an 'other...' > item that brings up an open panel. I don't know about the separators but I have done the 'Other...' item successfully. Referring to my previous message, define a new class c

Re: some advice on asynchronous control please

2010-02-19 Thread Ken Thomases
On Feb 19, 2010, at 4:06 PM, Damien Cooke wrote: > I have a situation where I am using a 3rd party library to manage content on > their service. When I delete an entry the method requires a call back all > good. Now I need to wait for that call back to be called to know if it was > successful

Re: Appropriate -setWantsLayer: timing

2010-02-19 Thread Simon Wolf
On 19 Feb 2010, at 03:50, Scott Anguish wrote: > > On Feb 16, 2010, at 5:45 PM, Simon Wolf wrote: > >>> >>> I'm wondering when writing a layer hosting view, when the most appropriate >>> time is to set the layer and call -setWantsLayer:YES? >>> >>> Calling it in -initWithFrame: is too early a

Re: some advice on asynchronous control please

2010-02-19 Thread Jens Alfke
On Feb 19, 2010, at 2:06 PM, Damien Cooke wrote: I have a situation where I am using a 3rd party library to manage content on their service. When I delete an entry the method requires a call back all good. Now I need to wait for that call back to be called to know if it was successful or

some advice on asynchronous control please

2010-02-19 Thread Damien Cooke
Hi All, I have a situation where I am using a 3rd party library to manage content on their service. When I delete an entry the method requires a call back all good. Now I need to wait for that call back to be called to know if it was successful or not. In the call back I can set a boolean to i

Re: Overriding NSPopUpButton

2010-02-19 Thread Kyle Sluder
On Fri, Feb 19, 2010 at 1:31 PM, Gustavo Pizano wrote: > Is it possible to give a different color to the popupbutton?  not the default > one? will  overriding NSPopUpButtonCell make the job? or are there any other > aspects to take into mind when doing it? You would have to do all the drawing y

Re: selectItemWithObjectValue

2010-02-19 Thread Kyle Sluder
On Fri, Feb 19, 2010 at 1:08 PM, David Blanton wrote: > Not really, as I call selectWithObjectValue  on an NSComboBox and the > warning is on an NSComboboxCell You are aware that many (most?) control methods are actually just cover methods for their underlying cells? The Control and Cell Programm

Re: How to detect if mouse on border of view

2010-02-19 Thread Murat Konar
Read up on NSView's addCursorRect:cursor: method. _murat On Feb 19, 2010, at 1:36 PM, Mazen M. Abdel-Rahman wrote: Thanks everyone for your help on this. I wanted to know if the mouse was on the border area prior to the mouse down event to determine if the mouse icon should change as the

Re: How to detect if mouse on border of view

2010-02-19 Thread Mazen M. Abdel-Rahman
Thanks everyone for your help on this. I wanted to know if the mouse was on the border area prior to the mouse down event to determine if the mouse icon should change as the mouse hovers over the border. Is there a way to do this without a mouseMoved event? Thanks, Mazen Abdel-Rahman > > -

Overriding NSPopUpButton

2010-02-19 Thread Gustavo Pizano
Hello. Is it possible to give a different color to the popupbutton? not the default one? will overriding NSPopUpButtonCell make the job? or are there any other aspects to take into mind when doing it? Thanks Gustavo___ Cocoa-dev mailing list (Coc

Re: NSTableView with PopUpButtonCell column with different content per row

2010-02-19 Thread Sean McBride
On 2/18/10 4:13 PM, Jerry Krinock said: >Quincey's answer is excellent, and abstract. Let me give you a concrete >example from one of my projects. Presumably your table is bound to an >array controller whose contentSet or contentArray is bound to a >collection of Foo objects in your data model.

Re: selectItemWithObjectValue

2010-02-19 Thread David Blanton
Not really, as I call selectWithObjectValue on an NSComboBox and the warning is on an NSComboboxCell but so what , I am doing just what the docs say and I get the warning ... that is the essence of the question On Feb 19, 2010, at 1:48 PM, Kyle Sluder wrote: On Fri, Feb 19, 2010 at 9:24

Re: what is a bindings pattern to check for a non-empty selection?

2010-02-19 Thread Joanna Carter
Le 19 févr. 2010 à 11:02, Jean-Denis Muys a écrit : > I am looking for a way to enable a button in my window only if some selection > has been made in the data. Currently the data is shown in a table view and is > handled through an NSArrayController. I am trying to bind the button's > "Enabled

Re: Hillegass printing challenge

2010-02-19 Thread Joanna Carter
Hi Folks >> May I ask about an issue I am having adding page numbers to a print out. Can I just jump in on this thread and ask where I can find info about printing a document like an invoice, where there is a header and then a list of invoice lines that is possibly longer than one page? Regard

NSData as value in NSManagedObject

2010-02-19 Thread Mikkel Eriksen
I've put a small NSXMLDocument into a Core Data binary property like this: code: NSManagedObject *object = /* ... */ NSXMLDocument *xmlDoc = /* ... */ [object setValue:[xmlDoc XMLData] forKey:@"xml"]; When I go to retrieve it, it's wrapped in an array: (gdb) print-object

Re: selectItemWithObjectValue

2010-02-19 Thread Kyle Sluder
On Fri, Feb 19, 2010 at 9:24 AM, David Blanton wrote: > I get this warning, but I never call these methods: > 2010-02-19 09:56:29.975 Customize It[338:10b] *** -[NSComboBoxCell > selectItemWithObjectValue:] should not be called when usesDataSource is set > to YES > I do call >        [self selectI

Re: setAction:@selector is not working ?

2010-02-19 Thread David M. Cotter
yes i've set a breakpoint and watched. in fact the values are the same before and after (indicating it was ALREADY set up correctly note the code below is called JUST before the call to popup the menu i only put that extra AE_OS_MAC stuff there to prove again that it is set correctly in reality

Re: Appropriate -setWantsLayer: timing

2010-02-19 Thread Matt Neuburg
On Wed, 17 Feb 2010 17:07:54 -1000, Dave Keck said: >> Maybe I'm misunderstanding, but I'm wondering, why not put everything into a >> single method and call that method from both initWithFrame and awakeFromNib? >> One and only one of these will be called (depending whether you are >> instantiatin

Re: setAction:@selector is not working ?

2010-02-19 Thread David M. Cotter
good tip, but no luck. same problem. myFunction is never called when i pick an item :( On Feb 19, 2010, at 11:50 AM, Michael Vannorsdel wrote: > I would try and reset the target just after setting the action: > > [myMenuItem setAction:@selector(myFunction:)]; > [myMenuItem setTarget:self]; >

Re: setAction:@selector is not working ?

2010-02-19 Thread Hank Heijink (Mailinglists)
On Feb 19, 2010, at 2:43 PM, David M. Cotter wrote: > just before the line of code that pops up the menu, i iterate over all the > items > so yes, i am absolutely sure it is getting called > and i am absolutely sure that myMenuItem is non null Posting you code is wildly more helpful than describ

Re: setAction:@selector is not working ?

2010-02-19 Thread Michael Vannorsdel
I would try and reset the target just after setting the action: [myMenuItem setAction:@selector(myFunction:)]; [myMenuItem setTarget:self]; I remember a long time ago I had a problem where if I reset the item's action, it would set the target to nil for some reason. So in practice I usually

Re: setAction:@selector is not working ?

2010-02-19 Thread David M. Cotter
just before the line of code that pops up the menu, i iterate over all the items so yes, i am absolutely sure it is getting called and i am absolutely sure that myMenuItem is non null i'm just wondering if there is something which pre-empts my code, telling the menu item to NOT call the action se

Re: setAction:@selector is not working ?

2010-02-19 Thread Jens Alfke
On Feb 19, 2010, at 11:31 AM, David M. Cotter wrote: i'm completely baffled by this. does anyone have a hint? i'm going to do a popup menu i run thru all the items and call [myMenuItem setAction:@selector(myFunction:)]; Where is that line of code? Are you sure it's getting called on the

Re: setAction:@selector is not working ?

2010-02-19 Thread David M. Cotter
i'm completely baffled by this. does anyone have a hint? >> i'm going to do a popup menu >> i run thru all the items and call >> >> [myMenuItem setAction:@selector(myFunction:)]; >> >> upon first run, my "myFunction" never gets called with the result of the >> menu item pick. >> >> but then,

Re: strange crash in NSAccessibility

2010-02-19 Thread James Maxwell
okay, thanks Greg. Good to know that assistive devices isn't supposed to gate crash just any old cocoa party! I'll look for the memory bug. cheers, J. On 2010-02-19, at 10:53 AM, Greg Parker wrote: > On Feb 19, 2010, at 10:41 AM, James Maxwell wrote: >> I have a strange crash happening while

Re: strange crash in NSAccessibility

2010-02-19 Thread Greg Parker
On Feb 19, 2010, at 10:41 AM, James Maxwell wrote: > I have a strange crash happening while trying load an open file window/sheet > (NSOpenPanel). > I've got a simple AppController class, which is set as the Application's > delegate. This is all there is to the controller, at this point: > > I

strange crash in NSAccessibility

2010-02-19 Thread James Maxwell
Hello All, I have a strange crash happening while trying load an open file window/sheet (NSOpenPanel). I've got a simple AppController class, which is set as the Application's delegate. This is all there is to the controller, at this point: #import "AppController.h" @implementation AppContro

Re: NSTableColumn's 'fontSize' Binding: Just Doesn't Work?

2010-02-19 Thread Jerry Krinock
On 2010 Feb 18, at 17:32, Keary Suska wrote: > you could just use the willDisplayCell delegate method? And indeed I did and it works. Thank you, Keary. I wasn't aware of that method. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please d

Re: Real-Time Validation in a NSTextField.

2010-02-19 Thread James Walker
On 2/18/2010 2:18 PM, Abhinay Kartik Reddyreddy wrote: I was wondering if there is any alternative / better approach for validating text in a textfield?? I've done this by writing a custom subclass of NSFormatter that overrides isPartialStringValid:newEditingString:errorDescription:. --

Re: How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

2010-02-19 Thread Lyndsey Ferguson
- (void)updateMyTextViewTextAttributes { NSMutableParagraphStyle* paragraphStyle = [[myTextView defaultParagraphStyle] mutableCopy]; if (paragraphStyle == nil) { paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; } float charWidth = [[myFont screenFon

Re: super call in the middle of a block of code ..

2010-02-19 Thread Clark Cox
On Fri, Feb 19, 2010 at 8:15 AM, Roland King wrote: > why would that leak it? Those calls are paired, a table enters editing mode, > the variable is set and what it's set to is retained, when the table exits > editing mode again the cached value is released and nil'ed. The variable is > also re

Re: Executing shell script with root privilege

2010-02-19 Thread cocoa learner
Steven, You are right. I got my way. Regards, Cocoa.learner On Mon, Feb 15, 2010 at 9:01 PM, Steven Degutis wrote: > Essentially you need to use the Security.framework API which you were > already using in the beginning. You're already heading in the right > direction. If you continue to read t

Re: How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

2010-02-19 Thread Douglas Davidson
On Feb 19, 2010, at 9:03 AM, lyndsey.fergu...@gmail.com wrote: > I've tried calling my updateMyTextViewTextAttributes call when myTextView has > the new myFont set. That doesn't change a thing. With updateMyTextViewTextAttributes as described, it will set the paragraph style for new text but w

Re: Customizing how errors are presented

2010-02-19 Thread Jerry Krinock
On 2010 Feb 19, at 07:55, Dado Colussi wrote: > I would like to customize how errors in controls like NSTextField > are presented. The documentation for NSResponder recommends overriding > -willPresentError: in order to customize error presentation. However, that > doesn't let me customize *how*

selectItemWithObjectValue

2010-02-19 Thread David Blanton
I get this warning, but I never call these methods: 2010-02-19 09:56:29.975 Customize It[338:10b] *** -[NSComboBoxCell selectItemWithObjectValue:] should not be called when usesDataSource is set to YES 2010-02-19 09:56:29.976 Customize It[338:10b] *** -[NSComboBoxCell indexOfItemWithObject

Re: Question about NSScrollView

2010-02-19 Thread Jack Carbaugh
If you review the documentation, it tells you how to show either the vertical or the horizontal scroller. On Feb 19, 2010, at 6:13 AM, Mario Kušnjer wrote: On 2010.02.19, at 11:43, Jack Carbaugh wrote: tell your NSScrollView to setAutoHidesScrollers:yes This should hide the scrollbars unti

Re: super call in the middle of a block of code ..

2010-02-19 Thread Steve Christensen
Oh, sorry, I was looking at the routine on its own. You're hanging onto preEditPath for the duration of the editing period and then releasing it when it's done. It's still early and I haven't had any coffee. :) On Feb 19, 2010, at 8:15 AM, Roland King wrote: why would that leak it? Those

Re: How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

2010-02-19 Thread Lyndsey Ferguson
My layout got messed up. Imagine that the " - 1 tab" is is tabbed in with the width of four spaces and that the " - 4 spaces" block lines up along with it. Also, imagine that: [smaller font] - 1 tab - 4 spaces has the " - 1 tab" offset to the right of the " - 4 sp

How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

2010-02-19 Thread Lyndsey . Ferguson
I'm working with an NSTextView and one of the requirements I have is that a tab character, '\t', shall have the same width as four spaces. So the text-content would look like this: - 1 tab - 4 spaces And this is how I accomplish this: // done when NSTextView first loaded and wh

Re: How to detect if mouse on border of view

2010-02-19 Thread Steve Christensen
On Feb 18, 2010, at 8:44 PM, Mazen M. Abdel-Rahman wrote: I was wondering if there is a straight forward away to know if the mouse is on the border of a view? I know how to detect if the mouse enters a view area by using NSTrackingArea - but how can I tell if the mouse is on a border? I w

Re: super call in the middle of a block of code ..

2010-02-19 Thread Roland King
why would that leak it? Those calls are paired, a table enters editing mode, the variable is set and what it's set to is retained, when the table exits editing mode again the cached value is released and nil'ed. The variable is also released in dealloc (not shown here). I do not know of a case w

Re: super call in the middle of a block of code ..

2010-02-19 Thread Steve Christensen
Although it looks like your code is leaking a NSIndexPath each time through because you retain it on "if (editing)" and release it on "if (!editing)". On Feb 18, 2010, at 7:53 AM, Luke the Hiesterman wrote: This seems fine to me. Generally, when subclassing, the contract is that you must

Customizing how errors are presented

2010-02-19 Thread Dado Colussi
I would like to customize how errors in controls like NSTextField are presented. The documentation for NSResponder recommends overriding -willPresentError: in order to customize error presentation. However, that doesn't let me customize *how* the error will be presented to the user. I am unhappy wi

Strange 'DrawTheMenu' crash

2010-02-19 Thread Paul Sanders
Has anyone ever experienced a crash like the one below? It is happening sporadically in the field (I have, I think, 5 crash logs, spread across all 3 major versions of OS X, i.e. 10.4, 10.5 and 10.6) but I have never seen it here. Examination of the object code reveals that NSCarbonMenuImpl+52

Re: Uncaught exceptions not terminating my app

2010-02-19 Thread Paul Sanders
Just a quick update on this for anyone still interested. To the list of exceptions to explicitly ignore in your uncaught exception handler, include NSPortTimeoutExceptions. These happen (rarely) when the spell checking service is busy or slow to start up (I'm not sure which, it's happening on

Re: Open panel is permanently dead?

2010-02-19 Thread Henry McGilton (Boulevardier)
On Feb 19, 2010, at 6:17 AM, Tom Davie wrote: > Hi, > > I'm having some problems with an open panel. I display the panel, allow the > user to chose and image, and then do some work, which involves showing a > sheet while the work is done. This all works wonderfully, until the user > clicks the

Open panel is permanently dead?

2010-02-19 Thread Tom Davie
Hi, I'm having some problems with an open panel. I display the panel, allow the user to chose and image, and then do some work, which involves showing a sheet while the work is done. This all works wonderfully, until the user clicks the "set texture" button again, and my method is called again.

Re: Determine smallest height of vertical scrollbar

2010-02-19 Thread Eric Gorr
I went ahead and filed an enhancement request on this one - rdar://7667092 On Feb 18, 2010, at 11:55 AM, Eric Gorr wrote: > Other then creating a dummy NSScoller and incrementally decreasing it's > height until usableParts returns 0, is there any easy way to determine what > the minimum height

Re: Help with creating CustomViews

2010-02-19 Thread Steven Degutis
It sounds a lot to me (and I could be wrong here) that you're trying to implement something along the lines of an ActiveX control as they were back when I used Visual Basic 5, in the sense that you want a "control" which is really a collection of other controls, and to be able to drag them around i

Re: what is a bindings pattern to check for a non-empty selection?

2010-02-19 Thread Steven Degutis
I too have been wondering how others approach this issue. For a long time I used "canRemove" and eventually switched to using my own value transformer which does the heavy lifting for me. But it's quite tedious to include this value transformer in every project I write which uses bindings like this

Re: what is a bindings pattern to check for a non-empty selection?

2010-02-19 Thread Ken Thomases
On Feb 19, 2010, at 7:15 AM, Jerry Krinock wrote: > On 2010 Feb 19, at 03:02, Jean-Denis Muys wrote: > >> I have tried bindings to selectedObjects using the model key "count", as a >> non zero count is obviously compatible with the BOOL that the property >> expects. But this doesn't work: I get

Re: what is a bindings pattern to check for a non-empty selection?

2010-02-19 Thread Jerry Krinock
On 2010 Feb 19, at 03:02, Jean-Denis Muys wrote: > I am trying to bind the button's "Enabled" property to the ArrayController so > that I get whether something is selected (multiple selections allowed). In code, write a simple subclass of NSValueTransformer, nonreversible, which transforms an

Minor resize trouble with NSScrollView

2010-02-19 Thread Shamyl Zakariya
Hi, I have a window which is split into two views (one atop the other). Both are NSScrollView instances containing a subclass of NSCollectionView (in an NSScrollView). The layout of the two views is dynamic -- sometimes only the top one is visible ( and takes up the full space ) and sometimes b

Re: Question about NSScrollView

2010-02-19 Thread Mario Kušnjer
On 2010.02.19, at 11:43, Jack Carbaugh wrote: tell your NSScrollView to setAutoHidesScrollers:yes This should hide the scrollbars until needed. http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSScrollView_Class/Reference/Reference.html That's one o

what is a bindings pattern to check for a non-empty selection?

2010-02-19 Thread Jean-Denis Muys
Hello, I have tried to search for an answer to that question, and I'm sure it must exist somewhere, but "bindings" and "select" or "selection" are definitely not specific enough. I am looking for a way to enable a button in my window only if some selection has been made in the data. Currently

Re: Question about NSScrollView

2010-02-19 Thread Jack Carbaugh
tell your NSScrollView to setAutoHidesScrollers:yes This should hide the scrollbars until needed. http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSScrollView_Class/Reference/Reference.html On Feb 19, 2010, at 3:10 AM, Mario Kušnjer wrote: Hi all !

Re: NSForegroundColorAttributeName without AppKit

2010-02-19 Thread Graham Cox
On 19/02/2010, at 7:05 PM, BareFeet wrote: > I have some working code for adding attributes to a string. I'd like to > modify it so it will work without needing AppKit. I can get it all going > except the NSForegroundColorAttributeName constant which seems to only exist > in AppKit. If you l

Question about NSScrollView

2010-02-19 Thread Mario Kušnjer
Hi all ! So I have a question on how to resolve a little issue I have with NSScrollView. I have created everything programmatically (a little exploration task to learn and understand how to do stuff without IB). I have an NSOutlineView enclosed in an NSScrollView (as recommended by document

NSForegroundColorAttributeName without AppKit

2010-02-19 Thread BareFeet
Hi all, I have some working code for adding attributes to a string. I'd like to modify it so it will work without needing AppKit. I can get it all going except the NSForegroundColorAttributeName constant which seems to only exist in AppKit. Here's an example: NSColor* tokenColor = [NSColor red