How to get the name of a method at runtime?

2008-03-09 Thread Stuart Malin
I'd like to have a method determine the name of the method that invoked it -- as an NSString. For example - (void) method1 { [someObject method2]; } - (void) method2 { // here, I'd like to be able to find the name of the caller // in this example, that would be "method

Re: How to get the name of a method at runtime?

2008-03-09 Thread Sherm Pendley
On Sun, Mar 9, 2008 at 4:44 AM, Stuart Malin <[EMAIL PROTECTED]> wrote: > I'd like to have a method determine the name of the method that > invoked it -- as an NSString. > > For example > > - (void) method1 { >[someObject method2]; > } > > - (void) method2 { >// here, I'd like to b

Re: ShortWeekNames

2008-03-09 Thread Alexander Griekspoor
Must have been late yesterday, I tried that then but it gave nothing, this morning my Mac was more friendly and it works perfect. Thanks! Alex On 9 mrt 2008, at 04:27, Nick Zitzmann wrote: On Mar 8, 2008, at 6:01 PM, Alexander Griekspoor wrote: what is now the blessed way of obtaining the u

Re: NSUserDefaults and mutability

2008-03-09 Thread Trygve Inda
> > On 8 Mar '08, at 1:57 PM, Trygve Inda wrote: > >> Is this expected? Can I rely on it? I will never need to change >> dict, but I >> am modifying items within a known sub Dictionary. > > Don't rely on this; it's entirely possible this behavior could change > in the future, causing your app to

How to get this bundle with identifier

2008-03-09 Thread Nick Rogers
Hi, In my app I need to get the icon for my HDD. For this I need to get the bundle with identifier "com.apple.iokit.IOStorageFamily". How can i get this bundle? Any help would be greatly appreciated. Wishes, Nick ___ Cocoa-dev mailing list (Cocoa-d

Re: NSUserDefaults and mutability

2008-03-09 Thread Ricky Sharp
On Mar 9, 2008, at 5:58 AM, Trygve Inda wrote: On 8 Mar '08, at 1:57 PM, Trygve Inda wrote: Is this expected? Can I rely on it? I will never need to change dict, but I am modifying items within a known sub Dictionary. Don't rely on this; it's entirely possible this behavior could change in

Re: How to get this bundle with identifier

2008-03-09 Thread Ricky Sharp
On Mar 9, 2008, at 6:48 AM, Nick Rogers wrote: In my app I need to get the icon for my HDD. For this I need to get the bundle with identifier "com.apple.iokit.IOStorageFamily". How can i get this bundle? Any help would be greatly appreciated. Please do at least some minimal searching. H

Re: How to get this bundle with identifier

2008-03-09 Thread Jean-Daniel Dupas
I don't think you really want to access the content of a private kernel extension. If your drive is mounted use -[NSWorkspace iconForFile:], else you should use Icon Manager functions to retreive the disk icon IconRef iconRef; OSStatus err = GetIconRef(kOnSystemDisk, kSystemIconsCreator,

Re: How to get this bundle with identifier

2008-03-09 Thread Jean-Daniel Dupas
Le 9 mars 08 à 13:23, Jean-Daniel Dupas a écrit : I don't think you really want to access the content of a private kernel extension. If your drive is mounted use -[NSWorkspace iconForFile:], else you should use Icon Manager functions to retreive the disk icon IconRef iconRef; OSStatus err

Re: How to create the slider switch in the time machine preference panel in system preferences?

2008-03-09 Thread Stephane Sudre
On Mar 9, 2008, at 1:40 PM, Scott.D.R wrote: Greetings everyone. Maybe many of us have enabled the time machine function for our leopards. Very cool machine. I am interested in the time machine preference panel. When you open it, there is a slider-like switch allow you to enable or disable

Re: How to get this bundle with identifier

2008-03-09 Thread Stéphane Sudre
On Mar 9, 2008, at 12:48 PM, Nick Rogers wrote: Hi, In my app I need to get the icon for my HDD. For this I need to get the bundle with identifier "com.apple.iokit.IOStorageFamily". How can i get this bundle? Since this kernel extension won't probably change its name and location: myBundl

how to get a particular icon from .icns file

2008-03-09 Thread Nick Rogers
Hi, I have a icon file (.icns) with 10 icons in it and i want to create an NSImage with only the 32x32 icon from this file. Currently I'm doing: NSImage *anIcon = [[NSImage alloc] initWithContentsOfFile:iconPath]; which results in a very big 128x128 icon. Regards, Nick

Detecting resolution changes?

2008-03-09 Thread [EMAIL PROTECTED]
I want to detect when a screen's resolution has changed, so I can resize and re-center my main window. Does "NSWindowDidChangeScreenProfileNotification" do what i want? If the user moves the window (into a differently-sized widow, causing a change), it looks like I could trap/check at "

Re: NSUserDefaults and mutability

2008-03-09 Thread Trygve Inda
>> Is it enough then to take the dictionary I get back and do a [dict >> mutableCopy]? >> >> Will this cascade down to the "subdicts" (dicts within the top level >> dict). > > > No it won't. mutableCopy only operates on one particular object and > not all its contained objects. While that beh

Re: How do I tell if the mouse button is down, independent of view, etc.?

2008-03-09 Thread Ryan Poling
It depends if you need to be notified when someone presses the button (or key), or if you just need to check whether it's currently down or not. If you want to be notified when they press the mouse button globally, look up CGEventTapCreate in the Xcode documentation. This could either be

Re: How to get the name of a method at runtime?

2008-03-09 Thread Jonathan Dann
I think maybe you missed the existence of _cmd. Both self (this object) and _cmd (this selector) are passed as implicit arguments to every Objective-C method. You can also call __func__ from within a method call, I use this often, NSLog(@"%p %s",self,__func__); // Thanks James Bucanek Jo

Determining why outline view column editing cancels for no apparent reason

2008-03-09 Thread Doug Knowles
I have an outline view in which I initiate editing of a particular column value when a new item is inserted into the outline. Recently (perhaps with the upgrade to Leopard), I've started seeing the behavior where the text field abruptly cancels the edit and discards the changes, for no apparent rea

Re: Determining why outline view column editing cancels for no apparent reason

2008-03-09 Thread Nick Zitzmann
On Mar 9, 2008, at 10:12 AM, Doug Knowles wrote: I'd like to set a breakpoint on the outline view or the field to see what's causing the cancellation, but I can't find a good candidate. Any debugging suggestions? I'd suggest trying -resignFirstResponder on NSTextView and its superclasse

Parent/Child initialization with NSTreeController

2008-03-09 Thread tim lindner
I need more control when the user creates objects in my application. I'm using an NSTreeController with CoreData (via Bindings). I have a parent object that does double duty as a child object thru parent and child relationships. Parent and child objects need to be initialized diferently. Parent o

Re: Determining why outline view column editing cancels for no apparent reason

2008-03-09 Thread Doug Knowles
Blindingly obvious, now that I've seen the light. Found the problem. Thanks, Nick, for taking the moment to help me out. Doug K; On Sun, Mar 9, 2008 at 1:15 PM, Nick Zitzmann <[EMAIL PROTECTED]> wrote: > > On Mar 9, 2008, at 10:12 AM, Doug Knowles wrote: > > > I'd like to set a breakpoint on th

Re: No parent window for sheets?

2008-03-09 Thread Paul Kim
Hi Jim, Maybe I should just send my queries directly to you in the future since you always seem to be the one answering :) I think traversing the window list is not worth it for what I am doing (it'll be on my blog soon). While the definition for -isSheet is somewhat odd, I think it shoul

Re: how to get a particular icon from .icns file

2008-03-09 Thread Michael Watson
if you look at the count of representations of that NSImage, you will find several sizes. (Assuming, of course, that the original .icns file contained multiple representations of different sizes.) -- m-s On 09 Mar, 2008, at 09:28, Nick Rogers wrote: Hi, I have a icon file (.icns) with 10

Re: NSUserDefaults and mutability

2008-03-09 Thread Ken Thomases
On Mar 9, 2008, at 10:50 AM, Trygve Inda wrote: In Carbon I could do: CFPropertyListCreateDeepCopy (kCFAllocatorDefault, localDict, kCFPropertyListMutableContainersAndLeaves); Is there a NSDictionary way to do this? The above. An NSDictionary is toll-free bridged to CFDictionaryRef, so go

Re: No parent window for sheets?

2008-03-09 Thread Mike Abdullah
I guess the assumption on the AppKit's part is that a particular panel/ window will not be recycled as both a sheet and a panel within an application. This kinda makes sense as there can only be a single modal panel up at a time, but there can be multiple sheets. Therefore the method is not

Re: Detecting resolution changes?

2008-03-09 Thread Ken Thomases
On Mar 9, 2008, at 10:05 AM, [EMAIL PROTECTED] wrote: I want to detect when a screen's resolution has changed, so I can resize and re-center my main window. Does "NSWindowDidChangeScreenProfileNotification" do what i want? If the user moves the window (into a differently-sized widow, caus

Re: How to get the name of a method at runtime?

2008-03-09 Thread Stuart Malin
Thanks Jon and Shem. I spaced out the existence of _cmd and was unaware of __func__ As I best understand their distinction: __func__ is generated at compile time (a C-string) _cmd is part of the Obj-C runtime (a SEL) Since I am writing a new method, I can accomplish my goal

Inverted images in selected segmented control segment

2008-03-09 Thread Alexander Griekspoor
Hi, If I use a rounded textured segmented control (the type finder uses in its toolbar of the windows to switch between column, browser view etc.) and fill a segment with one of the new template images like NSListViewTemplate, then when that segment is selected the image is nicely inverte

Viability of OSADictionaryView and OSADictionaryController.

2008-03-09 Thread [EMAIL PROTECTED]
Hello List Are OSADictionaryView and OSADictionaryController as featured in the IB 3 Open Scripting Kit plug-in viable in cocoa? The OSAKit header contains no interface for these classes, though OSADictionaryView exists as a nib within the OSAKit framework bundle. All enlightenment grateful

NSURLDownload and userInfo

2008-03-09 Thread Trygve Inda
I am using NSURLDownload and NSURLRequest to download 2 different types of data (A & B)... Both of which are related to the same class so they share delegate methods. In my delegate, when there is an error or successful completion I need to call one "process method" for A and a different one for B

Re: Inverted images in selected segmented control segment

2008-03-09 Thread I. Savant
If I use a rounded textured segmented control (the type finder uses in its toolbar of the windows to switch between column, browser view etc.) and fill a segment with one of the new template images like NSListViewTemplate, then when that segment is selected the image is nicely inverted. How

Displaying at appropriate time after text layout...?

2008-03-09 Thread Keith Blount
Hello, I have a multiple-page text view, much like the one in TextEdit, except that mine has a custom clip view that draws a shadow around the view it contains and the page view gets different text storages swapped in and out of it (using NSTextStorage's -addLayoutManager:). All of which makes

Re: how to get a particular icon from .icns file

2008-03-09 Thread Stéphane Sudre
On Mar 9, 2008, at 2:28 PM, Nick Rogers wrote: Hi, I have a icon file (.icns) with 10 icons in it and i want to create an NSImage with only the 32x32 icon from this file. Currently I'm doing: NSImage *anIcon = [[NSImage alloc] initWithContentsOfFile:iconPath]; which results in a very big

Re: How to get the name of a method at runtime?

2008-03-09 Thread Mike Abdullah
On 9 Mar 2008, at 19:18, Stuart Malin wrote: Thanks Jon and Shem. I spaced out the existence of _cmd and was unaware of __func__ As I best understand their distinction: __func__ is generated at compile time (a C-string) _cmd is part of the Obj-C runtime (a SEL) Since I am

Re: How to get the name of a method at runtime?

2008-03-09 Thread Tony Becker
If you're on Leopard, there is a new backtrace(3) call. If you're on Tiger, it's a little more complex... You can use the compiler function (long)__builtin_return_address(0) to find the address of your caller. Alas, there is no __builtin_return_symbol() Someth

Re: How to get the name of a method at runtime?

2008-03-09 Thread stephen joseph butler
On Sun, Mar 9, 2008 at 4:45 PM, Tony Becker <[EMAIL PROTECTED]> wrote: > If you're on Leopard, there is a new backtrace(3) call. > If you're on Tiger, it's a little more complex... > > You can use the compiler function > (long)__builtin_return_address(0) > to find t

Re: How to get the name of a method at runtime?

2008-03-09 Thread Bill Bumgarner
On Mar 9, 2008, at 2:59 PM, stephen joseph butler wrote: On Sun, Mar 9, 2008 at 4:45 PM, Tony Becker <[EMAIL PROTECTED]> wrote: If you're on Leopard, there is a new backtrace(3) call. If you're on Tiger, it's a little more complex... You can use the compiler function (long

Re: How to get the name of a method at runtime?

2008-03-09 Thread Tony Becker
I tried the dlsym() path, but couldn't make it work for me. I always got back nil; Maybe somebody else had more luck. On Mar 9, 2008, at 5:59 PM, stephen joseph butler wrote: On Sun, Mar 9, 2008 at 4:45 PM, Tony Becker <[EMAIL PROTECTED]> wrote: If you're on Leopard, there is a new backtrace

Re: How to get the name of a method at runtime?

2008-03-09 Thread Tony Becker
Agreed, I forgot to add that warning. I was using it to put fingerprints against alloc calls, retain/release cycles, and some other methods so I could track down memory leaks and some less then compliant code in debug builds. It should not end up in release builds. On Mar 9, 2008, at 6:06 P

Re: How to get the name of a method at runtime?

2008-03-09 Thread Jean-Daniel Dupas
ObjectAlloc and other Apple developement tools already record memory calls (retain, release, alloc, ...) full trace. You really doesn't need to reinvent the wheel to find leaks. Le 9 mars 08 à 23:17, Tony Becker a écrit : Agreed, I forgot to add that warning. I was using it to put fingerpr

Re: How to get the name of a method at runtime?

2008-03-09 Thread Stuart Malin
Interesting approach, Tony. However, __builtin_return_address isn't an object, so stringWithFormat throws an exception when given the %@ token. It should be %u (or %U ?? - I'm not sure of the difference). So, just so I could step through the code in the debugger, I wrote: int pid

Undo the binding value

2008-03-09 Thread Liviu Andron
Dear all, The problem, shorty: I cannot undo a bounded control's value in the KVO events chain A) The situation (I'm not using a Mac right now, so some names might be wrong.) - multiple nibs, some controls with bounded value

How to avoid deactivation of window below utility window

2008-03-09 Thread Peter Hoerster
Hi, I have a background application which displays a floating utility window on request via hotkey. If the user clicks any item in my window, the window of the formerly front application gets deactivated. This is unfortunate because the utility window should do something in the other progr

Re: How to avoid deactivation of window below utility window

2008-03-09 Thread Quincey Morris
On Mar 9, 2008, at 12:09, Peter Hoerster wrote: I have a background application which displays a floating utility window on request via hotkey. If the user clicks any item in my window, the window of the formerly front application gets deactivated. This is unfortunate because the utility w

NSLog goes to system.log, and it should not

2008-03-09 Thread Larry Campbell
The NSLog(v) documentation says: NSLogv writes the log to STDERR_FILENO if the file descriptor is open. If that write attempt fails, the message is sent to the syslog subsystem, if it exists on a platform, with the LOG_USER facility (or default facility if LOG_USER does not exist), with

Re: NSLog goes to system.log, and it should not

2008-03-09 Thread Jeff Johnson
Larry, I believe it's expected behavior on Leopard, though you may want to file a bug at least against the documentation. The following links provide more information on this topic: http://lapcatsoftware.com/blog/2008/01/06/logging-in-leopard/ http://boredzo.org/blog/archives/2008-01-19/n

Re: NSLog goes to system.log, and it should not

2008-03-09 Thread Larry Campbell
Hmm, OK. I've opened radar #5789236; we'll see what Apple says. - lc On Mar 10, 2008, at 12:17 AM, Jeff Johnson wrote: Larry, I believe it's expected behavior on Leopard, though you may want to file a bug at least against the documentation. The following links provide more information on

Causing CFLog error messages

2008-03-09 Thread Kevin Dixon
Hi, I'm new to Cocoa development...I've started an app that's going to be a simple Audio Unit host. Anyway, when I start up my app, in the Run Log I these errors 2008-03-10 02:30:08.571 StretchFix[2232] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x3103, name = 'co

Re: Causing CFLog error messages

2008-03-09 Thread Ron Fleckner
On 10/03/2008, at 5:34 PM, Kevin Dixon wrote: Hi, I'm new to Cocoa development...I've started an app that's going to be a simple Audio Unit host. Anyway, when I start up my app, in the Run Log I these errors 2008-03-10 02:30:08.571 StretchFix[2232] CFLog (0): CFMessagePort: bootstrap_reg