Knowing mouse pressed time?

2009-12-30 Thread Gustavo Pizano
Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds

Re: Knowing mouse pressed time?

2009-12-30 Thread slasktrattena...@gmail.com
Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate];

Re: Knowing mouse pressed time?

2009-12-30 Thread slasktrattena...@gmail.com
Sorry, haven't had my morning coffee yet. Of course, mouseUp should be: -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; // perform single-click action } } On Wed, Dec 30, 2009 at 11:53 AM,

Re: Notification when displays are detected?

2009-12-30 Thread Tobias Zimmerman
Adding this method to your application delegate should be sufficient: -(void)applicationDidChangeScreenParameters: (NSNotification *)notice { //Handle Display Change Here } If this isn't in the main class of your app, then you can make the class an NSApp delgate by adding this line to the

Re: Knowing mouse pressed time?

2009-12-30 Thread Gustavo Pizano
So let me see if I get it. Start the timer on mouseDown... and invalidate it on mouseUp, got that.. now the performholdAction method that you declared in the example, I call it from within.. ??? because I guess in this method I will check if the time its already 1 sec and show the menu...

Re: Knowing mouse pressed time?

2009-12-30 Thread slasktrattena...@gmail.com
The performholdAction is your timer's fire method. You set the timer to fire after one second. If the mouse button goes up before that, you invalidate the timer and so performholdAction is never called. -f On Wed, Dec 30, 2009 at 12:42 PM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: So

Re: Knowing mouse pressed time?

2009-12-30 Thread Gustavo Pizano
AHAH OK got it its one of the parameters when initializing the timer... ok... sorry for the noob question... :D On Dec 30, 2009, at 12:47 PM, slasktrattena...@gmail.com wrote: The performholdAction is your timer's fire method. You set the timer to fire after one second. If the mouse button

Re: Document-based application issue

2009-12-30 Thread Patrick Mau
Hallo Mac Lancer I have recently developed my first Cocoa Aplication creating custom ducumen bundles. What I did was to not only registering the document types but also export the file types in case they are not yet registered. This was my first app that supports a quicklook plugin for previes

Re: MyDocument.xib v MainMenu.xib

2009-12-30 Thread David Blanton
Thanks to all who gave advice. I'll give a description of what I did. If you have any further comments or suggestions please come forth! In MainMenu.xib An NSPanel that contains an NSOutlineView An Application Delegate that has a reference to the NSOutlineView In MyDocument.m - (id)init

Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Joshua Garnham
How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle { CGFloat

Re: MyDocument.xib v MainMenu.xib

2009-12-30 Thread Uli Kusterer
On 30.12.2009, at 06:23, David Blanton wrote: Putting the inspectors in MainMenu.xib will let me make just 'one set' for all documents but I am unsure as to how to get a reference from the inspector to the document given different xib's. Menus work the same way: There's one menu in

Re: Document-based application issue

2009-12-30 Thread Uli Kusterer
On 29.12.2009, at 19:53, Mac Lancer wrote: keyCFBundleTypeExtensions/key array stringaeep/string stringaeew/string stringjpg/string stringjpeg/string stringpng/string

Re: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Ross Carter
On Dec 30, 2009, at 10:43 AM, Joshua Garnham wrote: How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … -

Re: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Fritz Anderson
On 30 Dec 2009, at 9:43 AM, Joshua Garnham wrote: How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … -

Re: Knowing mouse pressed time?

2009-12-30 Thread Henry McGilton (Boulevardier)
On Dec 30, 2009, at 2:53 AM, slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; }

Re: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Joshua Garnham
But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods only. From: Ross Carter rosscarter...@me.com To: Joshua Garnham joshua.garn...@yahoo.co.uk Cc: cocoa-dev@lists.apple.com Sent: Wed, 30 December, 2009 16:12:18 Subject: Re: Setting

Using performSelector:withObject:afterDelay: to call a delegate method?

2009-12-30 Thread Helen Cooper
I want to be able to employ a delegate method after a delay. So what I have done, which works fine, is create a method in my class that calls the delegate method, and then I use performSelector:withObject:afterDelay: to call the second method: [self performSelector:@selector(doSomething00)

Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Thanks, Mr.

Re: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Fritz Anderson
On 30 Dec 2009, at 11:01 AM, Joshua Garnham wrote: But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods only. That's the point. You may _want_ to change the paragraph style's properties, but you can't. Casting the parameter doesn't turn an immutable object into a

Re: Encrypting Binary Strings

2009-12-30 Thread Tom Davie
Simple answer: no. If your application can still read the strings, so can a clever person, if by nothing else than sitting and patiently emulating a CPU with a piece of paper and a pencil. In order to actually secure something *you, or your recipient* have to be involved in decrypting it, by

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
Of course I know that, but I saw on the iPhone how the strings are encrypted and the only way for you to get the strings was if you used otool. Just that and I'll be satisfied. On Dec 30, 2009, at 11:32 AM, Tom Davie wrote: Simple answer: no. If your application can still read the strings,

Re: Using performSelector:withObject:afterDelay: to call a delegate method?

2009-12-30 Thread Bill Bumgarner
On Dec 30, 2009, at 9:08 AM, Helen Cooper wrote: [self performSelector:@selector(doSomething00) withObject:NULL afterDelay:4.0]; -(void)doSomething00{ [someDelegate doSomething]; } I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or

Re: Using performSelector:withObject:afterDelay: to call a delegate method?

2009-12-30 Thread Nick Zitzmann
On Dec 30, 2009, at 10:08 AM, Helen Cooper wrote: I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly? You can call any method you want using that method, even delegate methods. If you

Re: Encrypting Binary Strings

2009-12-30 Thread Todd Heberlein
On Dec 30, 2009, at 9:17 AM, Mr. Gecko wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find.

Re: Encrypting Binary Strings

2009-12-30 Thread Gleb Dolgich
On 30 Dec 2009, at 17:17, Mr. Gecko wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. I'm

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
Ok, I'll look up the different encodings I could do with openssl, Thanks for the suggestion. This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate

Core Data Bindings: NSFaultingMutableSet...addObserver...notSupported

2009-12-30 Thread Brad Gibbs
Hi, I'm trying to bind through a keyPath, but I'm getting nothing but errors. The most common is: [_NSFaultingMutableSet 0x200267fe0 addObserver:forKeyPath:options:context:] is not supported. Key path: projectCode I've read that bindings don't necessarily cause faults to fire, but I've got

ChangeCount for Multiple Undo Managers

2009-12-30 Thread Gordon Apple
When in the course of undo events, it becomes necessary to introduce multiple undo managers, certain issues arise. For example: How to handle the document change count? I currently have at least a half dozen independent undo managers for my document, which I keep in a bank near the document

Re: Encrypting Binary Strings

2009-12-30 Thread Gleb Dolgich
On 30 Dec 2009, at 17:59, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are

Displaying contents of more than one NSManagedObjectContext?

2009-12-30 Thread Rick Mann
Hi. I have an app that has the concept of parts libraries. I would like for my app to be able to open any number of library documents, each with its own NSManagedObjectContext, but display the parts palette as a single UI showing the union of all parts. Is this possible, or will I have to

Re: ChangeCount for Multiple Undo Managers

2009-12-30 Thread Mike Abdullah
On 30 Dec 2009, at 18:19, Gordon Apple wrote: When in the course of undo events, it becomes necessary to introduce multiple undo managers, certain issues arise. For example: How to handle the document change count? I currently have at least a half dozen independent undo managers for my

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
But then how would I get the data? If the key has to do with the password, then how can I get the parental settings and respond to them. On Dec 30, 2009, at 12:51 PM, Gleb Dolgich wrote: Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an

Re: Encrypting Binary Strings

2009-12-30 Thread Gleb Dolgich
You could store the generated key in a keychain. This way you wouldn't have to ask for the password to access the encryption key. -- Gleb Dolgich http://pixelespressoapps.com On 30 Dec 2009, at 18:58, Mr. Gecko wrote: But then how would I get the data? If the key has to do with the password,

Re: Using performSelector:withObject:afterDelay: to call a delegate method?

2009-12-30 Thread Helen Cooper
thanks - obvious. Should have caught this on my own:) From: Bill Bumgarner b...@mac.com To: Helen Cooper helen.coo...@rocketmail.com Cc: cocoa-dev@lists.apple.com Sent: Wed, December 30, 2009 12:37:38 PM Subject: Re: Using performSelector:withObject:afterDelay:

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
But then the child/teenager, if they know about keychain they could check it and find the key. Unless there is a way to prevent them from seeing it. Speaking of keychain, can you recommend me a good public domain keychain framework? I currently wrote my own and on some computers, the keychain

Re: Knowing mouse pressed time?

2009-12-30 Thread Gustavo Pizano
Henry hi. You mean with the NEEvent method that returns the timestamp?... I was trying that also, and as far as I understood its the timestamp between the App startup and the event... so I dunno how this might help me... maybe I misunderstood the API doc? To clarify the original question,

Re: ChangeCount for Multiple Undo Managers

2009-12-30 Thread Gordon Apple
Ah! That's what I missed. Thanks. I assume that just tests the zero state of changeCount. Maybe I can override that to return YES if any count is non-zero. This is a fairly complex document, involving a data hierarchy and various contexts (and editable windows) within that hierarchy. Some of

Re: Core Data Bindings: NSFaultingMutableSet...addObserver...notSupported

2009-12-30 Thread Quincey Morris
On Dec 30, 2009, at 10:12, Brad Gibbs wrote: Account ---ProjectSite---Project I'm trying to get the projects array controller to load all projects for the selected Account (so, all Projects for all ProjectSites). I've got an NSTableView listing accounts on the left, and view controllers

Merging changes across NSManagedObjectContexts

2009-12-30 Thread Rick Mann
In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and

Re: Encrypting Binary Strings

2009-12-30 Thread Gleb Dolgich
A teenager could also crack your app and use the key he found to gain access. If you want to prevent that, I guess you need to rethink the way you store access credentials. I wonder how [Snow] Leopard Parental Controls do that. You should also use Mac OS Keychain API and not reinvent the wheel

Re: Encrypting Binary Strings

2009-12-30 Thread Ken Thomases
On Dec 30, 2009, at 11:59 AM, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
It's ether that you don't understand what I'm doing, or I don't understand that. Here is the full story. I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings, when they save I am saving the settings in

Re: Encrypting Binary Strings

2009-12-30 Thread nicolas berloquin
Just as a word of advise. This is a public list that's indexed by search engines. So don't reveal anything here that you'd want to keep private. I'm not advising security through obscurity. If you use keychains or similar systems, knowing how it works won't help cracking anyway. But just in

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread Rick Mann
On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on

Re: Knowing mouse pressed time?

2009-12-30 Thread Henry McGilton (Boulevardier)
On Dec 30, 2009, at 11:43 AM, Gustavo Pizano wrote: Henry hi. You mean with the NEEvent method that returns the timestamp?... I was trying that also, and as far as I understood its the timestamp between the App startup and the event... so I dunno how this might help me... maybe I

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 1:58 pm, Rick Mann wrote: Is that operation discussed in the docs somewhere? Yes. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP30001200 mmalc ___

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread Mike Abdullah
On 30 Dec 2009, at 21:58, Rick Mann wrote: On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes

Re: Detect dim/brightness keys on laptop

2009-12-30 Thread Jeremy Pereira
On 25 Dec 2009, at 14:01, John Clayton wrote: My aim is to write a little util that swaps the function keys depending on which app is running (i.e. so that during certain apps you don't have to use the FN key on the laptop to get F1). So I need to have the ability to modify the event

AddressBook ABMultiValue -labelAtIndex:

2009-12-30 Thread Rainer Standke
When I ask an ABMultiValue for its labelAtIndex: I get some thing like this: _$!Other!$_ I would have expected to get this: other What's odd is that I do get this in the description of the ABMultiValue: * other 818 301 4670 w NG other 323 251 3660 c How can I get to the clean value?

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread Rick Mann
On Dec 30, 2009, at 14:08:15, Mike Abdullah wrote: On 30 Dec 2009, at 21:58, Rick Mann wrote: On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need

Re: Encrypting Binary Strings

2009-12-30 Thread Ken Thomases
On Dec 30, 2009, at 3:56 PM, Mr. Gecko wrote: It's ether that you don't understand what I'm doing, or I don't understand that. Here is the full story. I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the

Re: Knowing mouse pressed time?

2009-12-30 Thread Ken Thomases
On Dec 30, 2009, at 3:59 PM, Henry McGilton (Boulevardier) wrote: I meant that rather than setting a timer and implementing a callback method and remembering to invalidate the timer, and so on and so on, you can do something like this (which took less time to implement than the time required

Re: AddressBook ABMultiValue -labelAtIndex:

2009-12-30 Thread Aaron Tuller
At 2:19 PM -0800 12/30/09, Rainer Standke wrote: When I ask an ABMultiValue for its labelAtIndex: I get some thing like this: _$!Other!$_ I would have expected to get this: other How can I get to the clean value? The function you need is ABCopyLocalizedPropertyOrLabel:

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? If so, is there an example app I can look into and figure it out? Basically my means of AES is to prevent the user from changing the settings

Re: Encrypting Binary Strings

2009-12-30 Thread Ken Thomases
On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: On Dec 30, 2009, at 5:06 PM, Ken Thomases wrote: On Dec 30, 2009, at 3:56 PM, Mr. Gecko wrote: I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings,

Re: Encrypting Binary Strings

2009-12-30 Thread Mr. Gecko
On Dec 30, 2009, at 5:33 PM, Ken Thomases wrote: On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? You can store a very limited, specific

Re: testing email code in the simulator (MFMailComposeViewControllerDelegate)

2009-12-30 Thread David Duncan
On Dec 29, 2009, at 1:46 PM, Paul Archibald wrote: Is there a way to test the emailing code in my app from within the simulator? I don't have an iPhone. It looks like my code is working, but I would really like to see whether the message is actually being constructed and sent correctly. I

Re: Encrypting Binary Strings

2009-12-30 Thread Ken Thomases
On Dec 30, 2009, at 5:42 PM, Mr. Gecko wrote: On Dec 30, 2009, at 5:33 PM, Ken Thomases wrote: On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's

Re: testing email code in the simulator (MFMailComposeViewControllerDelegate)

2009-12-30 Thread Eric E. Dolecki
Second that. I have two Touches just for testing things out. Next stop iPhone. The simulator is great for testing quick compile type things, but you can't beat a Touch to see things in action. On Wed, Dec 30, 2009 at 6:50 PM, David Duncan david.dun...@apple.comwrote: On Dec 29, 2009, at 1:46

Save MyDocument

2009-12-30 Thread David Blanton
MyDocument is a subclass of NSDocument. The docs say: You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose what type to save) appears in the Save panel by overriding shouldRunSavePanelWithAccessoryView. The default accessory view is

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 2:24 pm, Rick Mann wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if

Re: Save MyDocument

2009-12-30 Thread David Blanton
Duh ... It was workling and I didn't see it. sorry for the bandwidth waste. On Dec 30, 2009, at 6:55 PM, David Blanton wrote: MyDocument is a subclass of NSDocument. The docs say: You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 2:08 pm, Mike Abdullah wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then