modifier key query

2008-12-26 Thread Wesley Smith
Is there a way to know if a modifier key (shift, ctrl, option, cmd, etc) is pressed? Obviously, there's this: NSUInteger modifierFlags = [theEvent modifierFlags]; but what if you need to know this information independent of an NSEvent? Anyway to get it? So far I haven't seen anything encouragin

Re: modifier key query

2008-12-26 Thread Ken Thomases
On Dec 26, 2008, at 2:04 AM, Wesley Smith wrote: Is there a way to know if a modifier key (shift, ctrl, option, cmd, etc) is pressed? Obviously, there's this: NSUInteger modifierFlags = [theEvent modifierFlags]; but what if you need to know this information independent of an NSEvent? Anyway t

Re: modifier key query

2008-12-26 Thread Wesley Smith
> > Given that you are informed with an event each time the modifiers change, > I'm not sure why you want to "know this information independent of an > NSEvent". Mainly because I'd like to be able to control various animating behaviors via key modifiers but if the user isn't generating new mouse

Re: shareware licensing, aquatic prime?

2008-12-26 Thread Thomas Davie
On 26 Dec 2008, at 08:22, aaron smith wrote: hey all, I've been looking around for different licensing techniques, I've come across aquatic prime which looks pretty secure. but after reading quite a few debates about it, it makes me skeptical. is there anyone out there who uses it, or can vouch

Re: modifier key query

2008-12-26 Thread Ron Fleckner
On 26/12/2008, at 7:23 PM, Wesley Smith wrote: Mainly because I'd like to be able to control various animating behaviors via key modifiers but if the user isn't generating new mouse or key events, you can't tell if a modifier key has been pressed/released, which can make for awkward interface e

Re: NSToolbarItem identifier?

2008-12-26 Thread Brandon Walkin
On 22-Dec-08, at 4:37 AM, Quincey Morris wrote: On Dec 22, 2008, at 00:44, aaron smith wrote: I haven't been able to figure out how to set a custom identifier with NSToolbarItem's. Is it possible? I don't see it anywhere in IB, or anywhere in the class documentation? I can see the identifier

NSTextField super imposes the text

2008-12-26 Thread Nick Rogers
Hi, I have to frequently show text in the status field of my app. The status field is an NSTextField. but it super imposes the text that is sent to it thru setStringValue: I tried setting the text to @"", between the calls, but to no avail. This is happening only in Prior-Leopard Mac OSX. please

NSActionCell, is there a double click?

2008-12-26 Thread Nick Rogers
Hi, I have the outlineview cell which is a subclass of NSActionCell. I can set its target and action with setTarget: and setAction:. But it invokes the method on single click. Whereas I want the method to be called only on double click, I have seen the docs and there is no method like setDoubleA

Re: NSTextField super imposes the text

2008-12-26 Thread Nick Rogers
Here super-imposition means that text appears garbled and is put over the previous text. Thanks, Nick On 26-Dec-08, at 7:48 PM, Nick Rogers wrote: Hi, I have to frequently show text in the status field of my app. The status field is an NSTextField. but it super imposes the text that is sent

Re: NSActionCell, is there a double click?

2008-12-26 Thread Jerry Krinock
On 2008 Dec, 26, at 6:23, Nick Rogers wrote: I have the outlineview cell which is a subclass of NSActionCell. I can set its target and action with setTarget: and setAction:. But it invokes the method on single click. Whereas I want the method to be called only on double click, I have seen the

Re: NSActionCell, is there a double click?

2008-12-26 Thread Nick Rogers
Thanks for the reply. I have earlier tried setDoubleAction: for the entire outlineview, but its working only on Leopard and not before Leopard. I'm setting the dataCell of all the columns as non-editable, may be it has something to do with that. But I have also tried setting the desired colum

Re: A Problem with HUD Panel as the Main App's Window

2008-12-26 Thread Michael Ash
On Thu, Dec 25, 2008 at 5:04 AM, Oleg Krupnov wrote: > I'm writing a small app whose main window is a HUD panel. In my XIB > file I changed the class of the Window object from NSWindow to NSPanel > and checked the HUD box that appeared. > > The problem is that after the program starts, sometimes (

Re: NSActionCell, is there a double click?

2008-12-26 Thread Jerry Krinock
On 2008 Dec, 26, at 6:48, Nick Rogers wrote: I have earlier tried setDoubleAction: for the entire outlineview, but its working only on Leopard and not before Leopard. I'm setting the dataCell of all the columns as non-editable, may be it has something to do with that. But I have also tried s

Quartz compoziton colors not good in Cocoa App

2008-12-26 Thread Gustavo Pizano
Hello, well.. I manage to do something which I like to simulate some movement of the sea for my game, Naval Battle. this is the composition I made, but somehow when I put it in my app, following the documentation, the colors are not the same, or the lighting spot its too high, i tried

Re: Memory Management question

2008-12-26 Thread Andy Lee
From the code shown, it doesn't look like you're breaking any memory management rules. However, I notice there's a variable lastOpened, and I wonder if that's being dealloc'ed prematurely. If you step through the method with the debugger, does it definitely show that it's going through th

Re: modifier key query

2008-12-26 Thread Gerd Knops
On Dec 26, 2008, at 2:04 AM, Wesley Smith wrote: Is there a way to know if a modifier key (shift, ctrl, option, cmd, etc) is pressed? Obviously, there's this: NSUInteger modifierFlags = [theEvent modifierFlags]; but what if you need to know this information independent of an NSEvent? Anyway

Re: Memory Management question

2008-12-26 Thread j o a r
On Dec 25, 2008, at 11:30 AM, Scott Wilson wrote: NSLog(@"url %@", [desiredURL path]); // get EXC_BAD_ACCESS if link was an NSURL I'd suggest that you try to troubleshoot this using NSZombieEnabled. Is it possible that link is being autoreleased before my method has returned? That do

Re: Memory Management question

2008-12-26 Thread Robert Marini
1) desiredURL and link are, in essence, the same object. As far as the system is aware though, only one of those (link) is responsible for it. It is entirely possible that link is being sent -release in another method executing on another thread and so you absolutely should retain the var

[pool release] error

2008-12-26 Thread Steve Wetzel
Does anyone know why the follow code produces an error on [pool release]?. I get the following error : "*** -[NSDecimalNumber release]: message sent to deallocated instance 0x10c310". How am I overreleasing anything #import "Fraction.h" @implementation Fraction -(id)init { if(self =

Re: [pool release] error

2008-12-26 Thread Roland King
[decimalNumber release]; decimalNumber = [tempNum decimalNumberByDividingBy:tempDenom]; that releases the earlier retained decimalNumber then replaces it with one from a convenience method decimalNumberByDividingBy: which doesn't have a retain count (not alloc, not copy), so

Re: [pool release] error

2008-12-26 Thread Dave Carrigan
On Dec 26, 2008, at 8:29 AM, Steve Wetzel wrote: -(void)setNumerator:(NSInteger)n { [numerator release]; numerator = [NSNumber numberWithInteger:n]; +numberWithInteger creates an autoreleased object. You are also releasing numerator explicitly in your -dealloc method, so whe

Re: [pool release] error

2008-12-26 Thread Robert Marini
So... firstly, - tempNum = [[NSDecimalNumber alloc] init] at the end of a method after assigning an autoreleased instance of NSDecimalNumber to it - why? I'm trying to understand the logic in this and can't. As near as I can tell you aren't doing any book- keeping of this later on. What I

Re: modifier key query

2008-12-26 Thread Wesley Smith
Thanks, works like a charm. wes On Fri, Dec 26, 2008 at 5:10 AM, Ron Fleckner wrote: > > On 26/12/2008, at 7:23 PM, Wesley Smith wrote: >> >> Mainly because I'd like to be able to control various animating >> behaviors via key modifiers but if the user isn't generating new mouse >> or key events,

Re: [pool release] error

2008-12-26 Thread mmalc Crawford
On Dec 26, 2008, at 8:29 AM, Steve Wetzel wrote: Does anyone know why the follow code produces an error on [pool release]?. I get the following error : "*** -[NSDecimalNumber release]: message sent to deallocated instance 0x10c310". How am I overreleasing anything There are so many prob

Re: Memory Management question

2008-12-26 Thread Michael Ash
On Fri, Dec 26, 2008 at 11:27 AM, Robert Marini wrote: > 1) desiredURL and link are, in essence, the same object. As far as the > system is aware though, only one of those (link) is responsible for it. The system is not aware of responsibility at all. By the time memory management happens, all c

Re: Quartz compoziton colors not good in Cocoa App

2008-12-26 Thread Matt Long
Have you tried setting a "Clear" renderer as Layer 1? Are you loading the composition in a QCView or a Core Animation QCCompositionLayer? Also, do your dimensions match between the composition and the view you're loading it into? -Matt On Dec 26, 2008, at 8:30 AM, Gustavo Pizano wrote:

Re: [pool release] error

2008-12-26 Thread Steve Wetzel
Thanks for the info Dave, How do you know that number with Integer creates an autoreleased object? I do not see that in the documentation. As also mentioned in a reply, decimalNumberByDividingBy does not have a retain count either. I am new to mac programming but I do not see this in th

Re: [pool release] error

2008-12-26 Thread Bill Bumgarner
On Dec 26, 2008, at 9:41 AM, Steve Wetzel wrote: How do you know that number with Integer creates an autoreleased object? I do not see that in the documentation. As also mentioned in a reply, decimalNumberByDividingBy does not have a retain count either. I am new to mac programming but I

Re: Quartz compoziton colors not good in Cocoa App

2008-12-26 Thread Gustavo Pizano
Hello. Have you tried setting a "Clear" renderer as Layer 1? No I havent I will try Are you loading the composition in a QCView or a Core Animation QCCompositionLayer? Also, do your dimensions match between the composition and the view you're loading it into? Im using a QCCompositionLayer

Re: NSTextField super imposes the text

2008-12-26 Thread Nick Rogers
Hi, Looking at the code closely, I found that I was updating this text field from a separate thread. That may be the reason. Although I have still to test the fix on Prior-Leopard machine. Thanks, Nick On 26-Dec-08, at 7:59 PM, Nick Rogers wrote: Here super-imposition means that text appears

Re: Memory Management question

2008-12-26 Thread j o a r
On Dec 26, 2008, at 9:28 AM, Michael Ash wrote: But yes, generally, you should retain any object that's being passed into a method to ensure that it stays around for the lifetime of that method and release them when you exit. Absolutely false. Never do this. If you find yourself doing th

Re: Memory Management question

2008-12-26 Thread Robert Marini
The system is not aware of responsibility at all. By the time memory management happens, all concept of local variables has disappeared. The system cannot know, and does not care, what variables are "responsible" for an object. All it cares about is properly balanced retains and releases. Perhap

Re: [pool release] error

2008-12-26 Thread Steve Wetzel
Thanks mmalc, Your post helps tremendously, I kept asking myself how do I know if I am the owner of an object??? After reading the memory management info you linked to I think I am beginning to understand. I am new to mac programming and you have really helped me understand some of the

Re: Memory Management question

2008-12-26 Thread mmalc Crawford
On Dec 26, 2008, at 10:18 AM, Robert Marini wrote: Perhaps I wasn't clear enough in my statement as that was what I was trying to get across - if it's only been retained once it will only take one release message to trigger dealloc. As the author stated in his first post, by retaining lin

Re: Memory Management question

2008-12-26 Thread Michael Ash
On Fri, Dec 26, 2008 at 1:18 PM, Robert Marini wrote: >> I have never wrapped any methods in retain/release calls as you >> described. I've never seen code that does it, and I've never even >> *heard* of anyone doing it until now. Ask yourself this: do you do >> [self retain] at the beginning of a

Re: Memory Management question

2008-12-26 Thread Robert Marini
Yes, you can. This simply leads to voodoo programming where retains and releases are sprinkled throughout your code as a substitute for understanding. In addition to deferring absorbtion of the Basic Rules, it's almost certainly going to lead to a problem at some stage when you retain and

Re: Messaging framework

2008-12-26 Thread Torsten Curdt
On Wed, Dec 24, 2008 at 18:20, Robert Marini wrote: > I've heard good things about pantomime though haven't used it myself (and I > understand it has a few gotchas related to international characters). While I first was quite happy with Pantomime http://vafer.org/blog/20080604120118 I ended up

Re: NSToolbarItem identifier?

2008-12-26 Thread aaron smith
oh sweet. thanks Brandon. good stuff. On Fri, Dec 26, 2008 at 4:43 AM, Brandon Walkin wrote: > > On 22-Dec-08, at 4:37 AM, Quincey Morris wrote: > >> On Dec 22, 2008, at 00:44, aaron smith wrote: >> >>> I haven't been able to figure out how to set a custom identifier with >>> NSToolbarItem's. Is

Re: Verify that only one launchd-started process runs at a time

2008-12-26 Thread Per Ohlson
Thanks, this was exacly what I was looking for. I didn't know where to start with semaphores on OSX. Works like a charm. /P 26 dec 2008 kl. 02.10 skrev Ken Thomases: On Dec 25, 2008, at 6:22 PM, Jerry Krinock wrote: On 2008 Dec, 25, at 15:29, Per Ohlson wrote: I would like to make shure

Single Heading in TableView Source list ...

2008-12-26 Thread vince
Thanks for the help, I want to add a single heading to a tableView source list. Can someone point me to an example? thx. v. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Con

Re: Single Heading in TableView Source list ...

2008-12-26 Thread vince
I found it ... http://developer.apple.com/samplecode/SourceView/ thx. v. On Fri, Dec 26, 2008 at 8:12 PM, vince wrote: > Thanks for the help, > I want to add a single heading to a tableView source list. Can someone > point me to an example? > > thx. > > v. > > > > __

Scripting Bridge and System Events

2008-12-26 Thread Kevin Wojniak
I am trying to write a method to set the Desktop picture using Scripting Bridge and System Events. Header is generated via: sdef /System/Library/CoreServices/System\ Events.app | sdp -fh -- basename SystemEvents The working AppleScript is: set picture of desktop 1 to POSIX file "/Some/file

Quartz Bindings

2008-12-26 Thread Jay Kickliter
I have a quartz patch with two inputs, "pitch" and "roll". I read through the quartz bindings tutorial, and I'm able to bind NSSliders to the inputs with no problem. But I don't want to bind the inputs to UI elements. I need to bind them to two floats in my AppController, also called "pitch

[NSWindow initWithWindowRef] limitations

2008-12-26 Thread Garrick Meeker
I don't see much documentation about this, at least not about any limitations that might be involved. Should I expect any carbon calls, such as ShowWindow, to still function? Will all event handlers still operate normally? Can I take any carbon window and its associated code and wrap in

Best way to get messages OUT

2008-12-26 Thread Ashley Perrien
I'm still relatively new to Cocoa (and programming in general) and very new to iPhone but this is more of a general question I've been struggling with. What is the best / most accepted way to get a message out of an object? Scenario 1: I have a document application with an NSView that is bas

Can I replace NSMatrix contents in the action method

2008-12-26 Thread Jeffrey Scofield
I have an application that was crashing mysteriously. After much effort I boiled it down to a fairly small example, reproduced below. In the example, there's an NSMatrix containing 9 NSButtonCells. When the user clicks on one of the buttons, all of the button cells are replaced with newly alloca

NSSpeechRecognizer and Speech Recognition calibration

2008-12-26 Thread Christopher Corbell
I'm working on an accessibility app for the visually impaired and was hoping to use NSSpeechRecognizer. I've found it extremely difficult to get NSSpeechRecognizer to behave predictably on my system. Does anyone on the list have experience with this class & success with the Speech Recognition sys

Sending message to parent object

2008-12-26 Thread Ashley Perrien
I'm still relatively new to Cocoa (and programming in general) and very new to iPhone but this is more of a general question I've been struggling with. What is the best / most accepted way to get a message out of an object? Scenario 1: I have a document application with an NSView that is bas

Re: NSSpeechRecognizer and Speech Recognition calibration

2008-12-26 Thread Michael Ash
On Fri, Dec 26, 2008 at 5:56 AM, Christopher Corbell wrote: > I'm working on an accessibility app for the visually impaired and was hoping > to use NSSpeechRecognizer. > > I've found it extremely difficult to get NSSpeechRecognizer to behave > predictably on my system. Does anyone on the list hav

Re: Sending message to parent object

2008-12-26 Thread Robert Marini
There is generally any number of ways, as you indicate. In some cases your solution to the problem might be a target/action-like system. Generally KVO will be more flexible but is not without it's own unique set of problems (I'd suggest looking at http://shiftedbits.org/2008/07/24/key-value-

Re: Quartz Bindings

2008-12-26 Thread Matt Long
The quartz composition key paths are going to be: @"patch.pitch.value" @"patch.roll.value" If you are using a QCCompositionLayer, you can simply call [layer setValue:[NSNumber numberWithFloat:pitch] forKeyPath@"patch.pitch.value"] or even more simply [layer setValue: [NSNumber numberWithFlo

Core Data - fresh data for text field not connected to array controller

2008-12-26 Thread Steve Steinitz
Hello, I'm using core data (sqlite) in a multi-user environment. With a little tweaking, each machine now has fresh data when it counts -- at least when I bind text fields (etc) to array controllers of managed objects -- the KVO seems to work almost by magic. However, I have one entity tha

Re: Core Data - fresh data for text field not connected to array controller

2008-12-26 Thread mmalc Crawford
On Dec 26, 2008, at 9:48 PM, Steve Steinitz wrote: However, I have one entity that has only one record (for user preferences). I fetch the record fresh into its very own managedObjectContext for each access -- and even resetting the managedObjectContext. That direct binding, bypassing an

Re: Core Data - fresh data for text field not connected to array controller

2008-12-26 Thread Steve Steinitz
Hi mmalc, Thanks for your reply. I've answered your questions below. On 26/12/08, mmalc Crawford wrote: However, I have one entity that has only one record (for user preferences). I fetch the record fresh into its very own managedObjectContext for each access -- and even resetting the mana