Accessing members from NSDictionary

2013-04-05 Thread Pax
I have a situation where a user might have a great many information windows open at the same time (like the situation in Finder where you can click on a file and select 'Get Info' ad infinitum.) In order handle this situation, and so that I can still update each Window individually, I decided t

Re: Accessing members from NSDictionary

2013-04-05 Thread Mike Abdullah
On 5 Apr 2013, at 13:38, Pax wrote: > I have a situation where a user might have a great many information windows > open at the same time (like the situation in Finder where you can click on a > file and select 'Get Info' ad infinitum.) > > In order handle this situation, and so that I can sti

Re: Accessing members from NSDictionary

2013-04-05 Thread Pax
On 5 Apr 2013, at 14:20, Mike Abdullah wrote: > > For a start, trying to access instance variables directly is almost always a > bad idea. Expose proper accessor methods instead. > Why is it a bad idea? I do this quite often, and I find it has the double benefit of improving readability and

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
On 5 Apr 2013, at 14:55, Pax <45rpmli...@googlemail.com> wrote: > On 5 Apr 2013, at 14:20, Mike Abdullah wrote: > >> >> For a start, trying to access instance variables directly is almost always a >> bad idea. Expose proper accessor methods instead. >> > Why is it a bad idea? I do this quit

Re: Accessing members from NSDictionary

2013-04-05 Thread Pax
Ah, I see. I shall try that out. And, referring to my earlier question, would I be able to: [[device objectForKey:@"InformationWindowRef"].infoWindow cascadeTopLeftFromPoint:NSMakePoint(20,20)]; On 5 Apr 2013, at 15:00, Tom Davie wrote: > The reason it's a bad idea is because it means that

Re: Accessing members from NSDictionary

2013-04-05 Thread Pax
…And how would I make '@property (assign, nonatomic) NSWindow* iWindow;' an IBOutlet so that I can hook it up to my window in interface builder? On 5 Apr 2013, at 15:00, Tom Davie wrote: > The reason it's a bad idea is because it means that you have two strongly > coupled components of code.

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
1) yes you could use the code you outlined to access the property 2) @property (assign, nonatomic) IBOutlet NSWindow *iWindow; Note though to be careful about the assign tag there – you may well want that to be a retain. Thanks Tom Davie On 5 Apr 2013, at 15:06, Pax <45rpmli...@googlemail.com>

Re: Accessing members from NSDictionary

2013-04-05 Thread Joseph Dixon
I never retain IBOutlet properties. The view retains the object when it is added, so also retaining the property would increase the retain count to 2. I have not encountered a condition where I was required to access an IBOutlet property after the view had been unloaded, so this approach has worked

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
On 5 Apr 2013, at 16:54, Joseph Dixon wrote: > I never retain IBOutlet properties. The view retains the object when it is > added, so also retaining the property would increase the retain count to 2. This assumes that the property you're talking about is a view, and that it's a subview of ano

Re: Accessing members from NSDictionary

2013-04-05 Thread Joseph Dixon
On Fri, Apr 5, 2013 at 10:55 AM, Tom Davie wrote: > This assumes that the property you're talking about is a view, and that > it's a subview of another view that's retained. The issue isn't quite as > simple as "never retain IBOutlets". Tom, You are right, of course. Most issues cannot be cov

Re: Providing a Service without activating an app

2013-04-05 Thread Andy Lee
Thanks, Uli! Indeed the thing to do is start with a regular Application project and tweak it. Quite simple once you know how. I wrote up what I learned here: And here's the service I wrote. It copies a selector to the clipboard

cursorUpdate was called, but cursor was not updated

2013-04-05 Thread Peng Gu
I have a custom button, which was added as a subview of a textview. And I want the cursor to be changed to arrowCursor instead of the beam cursor when hover on the button. So I added tracking area. The cursorUpdate method was indeed called, but the cursor was still the beam cursor. It seems the cu

Re: cursorUpdate was called, but cursor was not updated

2013-04-05 Thread Steve Mills
On Apr 5, 2013, at 12:25:05, Peng Gu wrote: > I have a custom button, which was added as a subview of a textview. And I > want the cursor to be changed to arrowCursor instead of the beam cursor > when hover on the button. > > So I added tracking area. The cursorUpdate method was indeed called, b

Re: Accessing members from NSDictionary

2013-04-05 Thread Jens Alfke
On Apr 5, 2013, at 7:03 AM, Pax <45rpmli...@googlemail.com> wrote: > Ah, I see. I shall try that out. And, referring to my earlier question, > would I be able to: > > [[device objectForKey:@"InformationWindowRef"].infoWindow > cascadeTopLeftFromPoint:NSMakePoint(20,20)]; No, because -objectF

Re: Providing a Service without activating an app

2013-04-05 Thread Mark Munz
.service was also designed to allow for dynamic services where an app could write out just the info.plist in a bundle.service and the NSServices key points to services offered by other apps. You could then have services created by apps using a single entry point with different user data to take dif