Re: Drag and drop query

2009-05-29 Thread Nate Weaver
It seems to me that you want to also use NSTIFFPboardType/ NSPDFPboardType with the image data. Mail/iPhoto like to deal with files (for attachments/library items), but TextEdit wants a raw image (IIRC). -W On May 30, 2009, at 4:21 AM, Srinivasa Prabhu wrote: Hi all, I am trying to drag

Re: Send click to window

2009-04-09 Thread Nate Weaver
There are actually 2 NSEvent methods that aren't in my local docs here at work, but are in the headers and on developer.apple.com: + (NSEvent *)eventWithCGEvent:(CGEventRef)cgEvent; - (CGEventRef)CGEvent; 10.5-only, though. On Apr 9, 2009, at 6:24 AM, Dave Keck wrote: Is it possible to send

Re: NSString* kMyKey = @"aKey" vs #define MYKEY @"aKey"

2009-04-03 Thread Nate Weaver
to one header, instead of header + .m) Cheers, Memo. On 3 Apr 2009, at 23:44, Quincey Morris wrote: On Apr 3, 2009, at 15:15, Nate Weaver wrote: IIRC they're optimized to point to the same memory location (I wasn't sure, so I tested and confirmed). I usually do: NSString * c

Re: NSString* kMyKey = @"aKey" vs #define MYKEY @"aKey"

2009-04-03 Thread Nate Weaver
IIRC they're optimized to point to the same memory location (I wasn't sure, so I tested and confirmed). I usually do: NSString * const kConstantNameHere = @"foo"; That's what I've seen in Apple headers (with an extern at the beginning and no assignment in said headers, of course). On Apr

Re: Best Strategy to Control iTunes

2009-03-31 Thread Nate Weaver
On Mar 30, 2009, at 5:44 PM, Ammar Ibrahim wrote: - It's known that if any dialog is open in iTunes it freezes any communication through the scriptable interface, how can I detect that and put all my "messages" in a queue, so that when iTunes is responsive, I can send my messages? W

Re: [Q] Contextual Menu Items Size

2009-03-18 Thread Nate Weaver
Either set the attributed title of the items, or don't use the same menu instance for your popup and context menu. On Mar 18, 2009, at 11:38 AM, Eric Gorr wrote: I have a popup menu whose control size is small. To a couple of views, I have done the following: [myView setMenu:[myPopupMenu me

Re: Changing the height of a NSTextField for editing

2009-02-23 Thread Nate Weaver
Try setting the frame of the field/field editor instead (doing unit conversions if necessary). When you change the bounds of something explicitly, you end up changing the drawing transformation as well (see under setBounds: and friends). This has bitten me in the butt before (recently!). H

Re: Which language to get started with cocoa development?

2009-01-06 Thread Nate Weaver
Objective-C is a pretty small addition on the top of regular C. It's the Cocoa libraries that take the time, no matter what language you use. On Dec 31, 2008, at 2:22 AM, Achim Domma wrote: Hi, I develop software for a living and want to get started with cocoa development just for fun. I'm

Re: Background color of disclosure triangle row

2008-12-17 Thread Nate Weaver
See the -outlineView:isGroupItem: delegate method. On Dec 17, 2008, at 11:30 AM, Eric Gorr wrote: This should be an easy one, but I am just not seeing it... In the sample code found at: http://developer.apple.com/samplecode/PhotoSearch/index.html The background color of the rows containing t

Re: Differences between -isEqual: and -isEqualTo:?

2008-09-19 Thread Nate Weaver
This is the gist of it, I think. NSArray and NSDictionary should be safe to store mutable objects, since they use an index or a key for storage position, and not the object (the value) itself. So (as I understand it): You *are* allowed to mutate objects in collections, but only if the objec

Re: NSXMLNode and NSXMLElement issue

2008-08-28 Thread Nate Weaver
You need to use NSXMLNode itself, and not NSXMLElement (since text nodes aren't elements). [NSXMLNode textWithStringValue:someString] or - [[NSXMLNode alloc] initWithKind:NSXMLTextKind], followed by - setStringValue:. Then just addChild: or insertChild:atIndex: with your new text node as norm

Re: Help converting NSFilePosixPermissions to Octal representation

2008-08-25 Thread Nate Weaver
Addendum: I guess the format should actually be %O (unsigned long) instead of %o (unsigned int) since it's defined as an unsigned long, though the upper bits probably won't be filled at all. On Aug 25, 2008, at 3:42 PM, Nate Weaver wrote: unsigned long perms = [[file

Re: Semi-transparent, blurred NSWindow background?

2008-08-25 Thread Nate Weaver
I believe the built-in stuff (menus, sheets, etc.) uses the private functions mentioned earlier. Honestly, if you really need this function to work exactly the same, AFAIK the private stuff is the only real way to do it. Simulating it via a custom NSView just seems really hackish and error-

Re: Help converting NSFilePosixPermissions to Octal representation

2008-08-25 Thread Nate Weaver
unsigned long perms = [[fileAttributes objectForKey:NSFilePosixPermissions] unsignedLongValue]; NSString *permsInOctal = [NSString stringWithFormat:@"%o", perms]; HTH On Aug 25, 2008, at 3:03 PM, Charles E. Heizer wrote: Hello, I have been googaling and searching but I must be missing someth

Re: monitoring file system

2008-08-25 Thread Nate Weaver
I think he wants to know when the directory contents change no matter what changes them (i.e., not his app). I'd look into the FSEvents framework or kqueue. On Aug 25, 2008, at 11:16 AM, Negm-Awad Amin wrote: Am Mo,25.08.2008 um 16:21 schrieb MAnish Billore: Hi, I am developing an image

Re: Converting NSString to valid HTML string

2008-08-21 Thread Nate Weaver
Those are for URL encoding; I think he wants HTML entities. I can't remember if there are Cocoa methods to do this, but you can use CFXMLCreateStringByEscapingEntities() (since NSString * and CFStringRef are toll-free bridged): NSString *input = @"2 < 4"; NSString *output = (NSString *)CF

Re: Opening an external file in a external application

2008-08-14 Thread Nate Weaver
- (BOOL)openURLs:(NSArray *)urls withAppBundleIdentifier:(NSString *)bundleIdentifier options: (NSWorkspaceLaunchOptions)optionsadditionalEventParamDescriptor: (NSAppleEventDescriptor *)descriptor launchIdentifiers:(NSArray **)identifiers Long method name, but you can pass in NSWorkspaceL

Re: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Nate Weaver
g 7, 2008 at 1:19 PM, Randall Meadows <[EMAIL PROTECTED] pc.com> wrote: On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote: I'd say just try the default options and see what happens. You might also look at -[NSWorkspace performFileOperation:source:destination:files:tag:] with NSWorkspa

Re: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Nate Weaver
I'd say just try the default options and see what happens. You might also look at -[NSWorkspace performFileOperation:source:destination:files:tag:] with NSWorkspaceRecycleOperation as the first argument. On Aug 7, 2008, at 2:03 PM, Randall Meadows wrote: The description for FSMoveObjectToT

Re: NSLog on releasebuild

2008-07-24 Thread Nate Weaver
h (even it for now it works). Le 23 juil. 08 à 20:01, Nate Weaver a écrit : This is the route I follow. I use normal NSLog() statements for conditions that "should never happen", and DebugLog() for debugging: #ifdef DEBUG #define DebugLog(s, ...) NSLog((@"%s %s:%d " s),

Re: NSLog on releasebuild

2008-07-23 Thread Nate Weaver
This is the route I follow. I use normal NSLog() statements for conditions that "should never happen", and DebugLog() for debugging: #ifdef DEBUG #define DebugLog(s, ...) NSLog((@"%s %s:%d " s), __func__, basename(__FILE__), __LINE__, ## __VA_ARGS__); #else #define DebugLog(s, ...) #endif T

Re: C99 [was: RESTful API's - Easy way to interact?]

2008-06-05 Thread Nate Weaver
FWIW, the default C dialect on OS X seems to allow a lot of C99 stuff (I assume because it defaults to GNU extensions): variable declarations anywhere in a block, "//" comments, and variable-length arrays. It doesn't allow declarations in the start of a for loop, though. On Jun 4, 2008, a

Re: Delegates

2008-05-19 Thread Nate Weaver
Delegates *are* often automatically registered for their delegated object's notifications, however. The differences between these and "regular" delegate methods should be apparent in the documentation, though, since the former will take a single argument of NSNotification *. (To help the

Re: Delegates

2008-05-19 Thread Nate Weaver
A delegate is simply another object that is asked for more information or asked to do something (often optional) on behalf of the sender or in response to something the sender does (e.g., a window resize, or a table asking whether its selection can change). So, if I'm correctly reading what

Re: whether to use NSSavePanel or something else

2008-05-19 Thread Nate Weaver
If you just want to let them choose a folder, use NSOpenPanel (calling -setCanChooseFiles:NO and -setCanChooseDirectories:YES on the save panel before displaying it). On May 19, 2008, at 11:04 AM, Nick Rogers wrote: Hi, I have to let the user browse thru the filesystem and choose a direct

Re: Uneditable NSTableView (SOLVED)

2008-04-23 Thread Nate Weaver
If that's the case, you can simply check [yourTableView numberOfSelectedRows] in -tableViewSelectionDidChange: and update the bottom view based on the result. On Apr 23, 2008, at 2:05 PM, Ewan Delanoy wrote: Corbinn Dunn wrote I'm not quite sure what you mean by "target" here The

Re: Consistent Contextual Menu in NSTableview

2008-04-21 Thread Nate Weaver
I would probably override -menuForEvent: instead of -rightMouseDown: . Leopard also has a bit nicer contextual menu handing for table/outline views: If you right-click a row that's not currently selected it highlights just an outline and doesn't change the selection (you can use -clickedRow

Re: Resorting normal field editor behaviour

2008-04-03 Thread Nate Weaver
I think what you probably want is to not use a custom field editor, but instead set your controller to the NSTableView's delegate (which it probably already is) and use the @"NSFieldEditor" key of the notification's userInfo dictionary to access the field editor. (Hopefully NSTableView isn'

Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Nate Weaver
Whoops, this jogged my memory. For some reason in my last response I thought -setAutoresizingMask specified the pinned margin and not the expanding margin. I'm not sure why... On Apr 2, 2008, at 11:13 AM, Cathy Shive wrote: Hi Hendrik, It seems that you're using the correct mask. The docum

Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Nate Weaver
You probably want to use NSViewMaxYMargin instead of NSViewMinYMargin (NSViewMinYMargin is the bottom margin of the content view and not the top). On Apr 2, 2008, at 9:35 AM, Hendrik Holtmann wrote: Hi, I am creating a borderless window in source like this: containerWindow = [[[ContainerWi

Re: Drawing from secondary thread erases resize corner in window?

2008-02-28 Thread Nate Weaver
On Feb 28, 2008, at 3:18 PM, Hank Heijink wrote: On Feb 28, 2008, at 2:56 PM, Nate Weaver wrote: Interesting... I hadn't thought of that. Don't I have to add another timer to the NSDefaultRunLoopMode though? If I have to chose between having two timers on the main thread that

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Nate Weaver
On Feb 28, 2008, at 1:49 PM, Hank Heijink wrote: On Feb 28, 2008, at 1:46 PM, Nate Weaver wrote: You could also use [[NSRunLoop mainRunLoop] addTimer:yourTimer forMode:NSEventTrackingRunLoopMode] and avoid another thread altogether. Interesting... I hadn't thought of that. Do

Re: Drawing from secondary thread erases resize corner in window? [solved, for now]

2008-02-28 Thread Nate Weaver
the only reason I'm trying to draw on another thread is that my drawing is timer-driven, and the timer gets suspended if it's on the main thread and the user clicks on a menu or a scrollbar or some such thing. You could also use [[NSRunLoop mainRunLoop] addTimer:yourTimer forMode:NSEventTracki