Re: Sending a Selector to another Class.

2009-10-22 Thread Paul M
With all due respect, but by 'directly answering the question' you are doing the OP and all those reading this list a dis-service. You are just rewarding his lazyness. The OP has already been told to bone up on Obj-C basics, and he's obviously completely ignored this advice, the reason being that

to implement a 1 sec repeating timer in a separate thread

2009-10-22 Thread Nick Rogers
Hi, I have been trying to implement a 1 second repeating timer, but its leading to retaining the target object of a thread from which I'm launching this timer thread. Here's my implementation. I'm running this method from my thread. - (void)setUpTimer { timerThread = [[NSThread alloc] initW

Re: to implement a 1 sec repeating timer in a separate thread

2009-10-22 Thread Dave Keck
I'm having a really hard time making sense of you message... > I have been trying to implement a 1 second repeating timer, but its leading > to retaining the target object That's expected behavior - NSTimers retain their targets. The target won't be deallocated until the timer has been invalidated

Re: "Sticky" Event tracking

2009-10-22 Thread Joel Norvell
Hi Francisco, When you click outside of your application, your window's delegate will receive a windowDidResignKey message. I don't know if this is the standard way of handling the type of case you described, but I believe it would work. Sincerely, Joel __

Re: NSNotificationCentre very slow - normal?

2009-10-22 Thread Graham Cox
On 22/10/2009, at 5:53 PM, Kyle Sluder wrote: On Oct 21, 2009, at 11:32 PM, Graham Cox wrote: My question is, is this a known slow spot? I've never noticed NSNotificationCentre being so slow before, and can't think why it would be. And of course, what can I do to help it? I've temporari

Re: to implement a 1 sec repeating timer in a separate thread

2009-10-22 Thread Nick Rogers
Hi, Thanks for the reply. My question was very vague, I admit. But now I have moved to your suggestion. I'm setting up the timer via [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self selector: @selector(doSomething:) userInfo: nil repeats: YES]; But the doSomething is not getting cal

Re: Search on Core data Table issue?

2009-10-22 Thread Matthew Lindfield Seager
A "reducing search" is more commonly referred to as filtering. A google search should help you very quickly as this is very easy with core data & bindings. If you're still struggling another keyword that may help is (NS)Predicate. Matt ___ Cocoa-dev ma

Re: to implement a 1 sec repeating timer in a separate thread

2009-10-22 Thread Dave Keck
Before I try to respond, I'd just like to say you've been mentioning threads a lot, but you haven't said anything that convinces me that more than one thread is necessary for what you're trying to do. Unless you're doing some serious number crunching, video encoding, curing cancer, etc. it's likely

Re: Sending a Selector to another Class.

2009-10-22 Thread Jim Kang
Jens, thanks for clearing up the thing about the selector defining a message (method plus parameters) rather than a method and thus not being tied to a class. On Thu, Oct 22, 2009 at 1:21 AM, Jens Alfke wrote: > > On Oct 21, 2009, at 9:43 AM, Jim Kang wrote: > > That selector is a unique index t

Re: How to run a panel that customizes a new NSDocument

2009-10-22 Thread Ben Haller
On 22-Oct-09, at 2:24 AM, Quincey Morris wrote: 1. Yes, there's a defect in the NSDocumentController design which makes it awkward to pass an initial state to a new document without having to re-implement everything that NSDocumentController does. Awkward but not impossible or even difficul

Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]

2009-10-22 Thread Motti Shneor
Thanks again. Regarding the Carbon Window problem, the FrontWindow() call was just an illustration. The WindowRef I'm supplying is of a visible (usually active and front) Document window. The problems are not even consistent, and will randomly occur. The desired behavior, though, will ver

NSTextField not getting mouseDown

2009-10-22 Thread Sander Stoks
Hello all, Executive summary: I have an NSTextField in an NSPanel which, under certain circumstances, doesn't receive mouseDowns anymore. Specifically, this happens after I end editing with Enter (instead of Tab) Background: I am using NSPanel to make a "tool window" for my app. This

NSScroller graphical lag/glitches

2009-10-22 Thread PCWiz
Hi, I have the following NSScroller subclass that creates a scroll bar with a rounded white knob and no arrows/slot (background): @implementation IGScrollerVertical - (void)drawKnob { NSRect knobRect = [self rectForPart:NSScrollerKnob]; NSRect newRect = NSMakeRect(kn

Re: Core data design related question

2009-10-22 Thread Stamenkovic Florijan
Hi Marc, On Oct 20, 2009, at 16:11, Marc Rink wrote: Heyas, I am quite new to Objective-C (and to some extend to OO concepts as well), so please be gentle with me :) I have a core data based document application that purpose is to access a mysql database (i am using the MCP Kit). The doc

Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]

2009-10-22 Thread glenn andreas
On Oct 22, 2009, at 8:44 AM, Motti Shneor wrote: Thanks again. Regarding the Carbon Window problem, the FrontWindow() call was just an illustration. The WindowRef I'm supplying is of a visible (usually active and front) Document window. The problems are not even consistent, and will rand

stringWithContentsOfURL with resulting error 256

2009-10-22 Thread James Lin
Hi, I am trying to access a PHP script (which adds an entry to MySQL database) on my server with the following call: NSString *result = [NSString stringWithContentsOfURL:theURL encoding:NSUTF8StringEncoding error:&error]; However, the result comes back with an NSError as the following: E

Re: NSTextField not getting mouseDown

2009-10-22 Thread Graham Cox
On 23/10/2009, at 1:08 AM, Sander Stoks wrote: Background: I am using NSPanel to make a "tool window" for my app. This window contains a few buttons, sliders, and an NSTextField. I wanted this window to avoid becoming key, so that the user can select a new tool on this window without her

Re: Displaying a view modally

2009-10-22 Thread glenn andreas
On Oct 21, 2009, at 7:54 PM, Saurabh Sharan wrote: Check out SFHudView by Buzz Andersen ( http://github.com/ldandersen/scifihifi-iphone/blob/master/UI/SFHFHUDView.h ) Saurabh That code runs contrary to the documentation ("iPhone Application Programming Guide", "Windows and Views"): Alt

Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]

2009-10-22 Thread Motti Shneor
Hi Glenn, Thanks for your note --- However, I experience these problems also when I'm completely document modal. As a decent programmer, I immediately assumed the problem was in my code, and wrote a quick test that did NOT block. I used the non- blocking recommended beginSheetForDirectory:

Re: Changing an NSToolbar Identifier

2009-10-22 Thread Matthias Arndt
Am 02.10.2009 um 06:53 schrieb Matthias Arndt: I introduced a new key in user defaults reflecting the "toolbar version". If the toolbar version stored in the user defaults doesn't match the toolbar version of the application I simply delete the old plist settings and the application will di

Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]

2009-10-22 Thread Steve Christensen
I don't know what the difference would be in trying to attach to a native NSWindow vs one that wraps a Carbon window. When I've done this in the past, I always knew that I was attaching to a native NSWindow. Sorry I can't be more helpful. steve On Oct 22, 2009, at 6:44 AM, Motti Shneor wr

Re: stringWithContentsOfURL with resulting error 256

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 7:16 AM, James Lin wrote: NSString *result = [NSString stringWithContentsOfURL:theURL encoding:NSUTF8StringEncoding error:&error]; However, the result comes back with an NSError as the following: Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x15d7b0 "Operation could

Re: Sending a Selector to another Class.

2009-10-22 Thread Bill Bumgarner
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote: > However, a selector is not a string. I was just listening to this podcast > with Mike Ash, and he discusses this around the 9:23 mark or so: > > http://podcast.mobileorchard.com/episode-23-mike-ash-on-the-objective-c-runtime-objects-and-the-runtime-

Re: NSTextField not getting mouseDown

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 7:08 AM, Sander Stoks wrote: But: if I cause editing to end by pressing the Enter key (instead of Tab), and then give another window the focus, clicking on the textfield doesn't cause a mouseDown to be receive anymore. The contents of the textfield stay selected (the f

Re: Sending a Selector to another Class.

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote: However, a selector is not a string. I was just listening to this podcast with Mike Ash, and he discusses this around the 9:23 mark or so: http://podcast.mobileorchard.com/episode-23-mike-ash-on-the-objective-c-runtime-objects-and-the-runtime-messa

Re: Sending a Selector to another Class.

2009-10-22 Thread Kyle Sluder
On Oct 22, 2009, at 9:01 AM, Jens Alfke wrote: This statement is true; however those integers happen to be the memory addresses of unique instances of the strings*. This makes it very efficient for the runtime to convert a selector to an NSString, and vice versa, and also helps with debugg

Re: Sending a Selector to another Class.

2009-10-22 Thread Jeff Johnson
On Oct 22, 2009, at 10:53 AM, Bill Bumgarner wrote: Selectors are strings, but it is an implementation detail. The runtime uniques the strings such that there is only ever one instance of, say, the "drawRect:" selector floating about. Thus, the runtime can use pointer comparison to determi

Re: Cocoa-dev Digest, Vol 6, Issue 1522

2009-10-22 Thread Greg Guerin
Ashley Perrien wrote: uint8_t *readBuffer; NSUInteger bufferLength; BOOL gotBuffer = [readStream getBuffer: &readBuffer length: &bufferLength]; if (gotBuffer) { int len = [readStream read: readBuffer maxLength: bufferLength]; if (len <= 0) NSLog(@"nothing read"); else NSLog(@"Read: %@", [[[N

Re: Sending a Selector to another Class.

2009-10-22 Thread mmalc Crawford
On Oct 22, 2009, at 9:54 am, Jeff Johnson wrote: > "Ignore bbum. We hereby promise never to break == for SEL. (But SEL is not > char*. We will break that.)" > And now that it's on the mailing lists, it can be considered part of Apple's > official documentation. ;-) > It already is:

Re: Search on Core data Table issue?

2009-10-22 Thread mmalc Crawford
On Oct 22, 2009, at 4:09 am, Matthew Lindfield Seager wrote: > A "reducing search" is more commonly referred to as filtering. A > google search should help you very quickly as this is very easy with > core data & bindings. > The question is related to iPhone and NSFetchedRestultsController, ther

Re: NSTextField not getting mouseDown

2009-10-22 Thread Sander Stoks
On Oct 22, 2009, at 4:17 PM, Graham Cox wrote: What you want is to remove all this stuff and look at [NSPanel setBecomesKeyOnlyIfNeeded:] which deals with whatever is necessary for you. Standard text fields and so on should then work properly. Duh. That was indeed what I needed to do. My

Re: stringWithContentsOfURL with resulting error 256

2009-10-22 Thread John Horigan
Try using curl (the command-line utility) to see _exactly_ what Cocoa gets from the server when it accesses that URL. The server could be doing something that confuses Cocoa but which PHP and Safari handle properly. -- john On Oct 22, 2009, at 8:52 AM, Jens Alfke wrote: On Oct 22, 2009,

Textured sheet with tabview

2009-10-22 Thread McLaughlin, Michael P.
Don't know if I did something wrong or this is a bug. [Leopard + Xcode 3.1.3] I thought I would make a (modal) sheet textured because it provided a nice contrast with its non-textured parent window. The sheet contains one tabview and an OK button. Each of four tabs contains a radio group (matri

Re: Core data design related question

2009-10-22 Thread Marc Rink
Hey Florijan! Thanks for your guidance: TBQH, i already came along your described way: started out with the obvious "Hello World" stuff, playing around with IB and different techniques to deal with object's etc. Eg i already had a working version of a window with a popup box feeded from a

Re: Core data design related question

2009-10-22 Thread Stamenkovic Florijan
On Oct 22, 2009, at 15:46, Marc Rink wrote: This means i need the ObjectController in every view i want to have access to the connection parameters. Yep, that seems right. However, i am now troubling around: I set the value Binding of the Textfield to the object Controllers.selection. in

re: Search on Core data Table issue?

2009-10-22 Thread Ben Trumbull
Not sure if this is the right place (I am sure someone will let me know if it is not) I have a iPhone application that has a UITable view that is backed by core data. I want to perform a reducing search so that only the items starting with the characters entered into the search bar are shown. T

Re: NSScroller graphical lag/glitches

2009-10-22 Thread Dave Keck
I'd imagine those artifacts are due to you not drawing the scroller's background. In -drawArrow:... and -drawKnobSlowInRect:..., you should: NSRectFillUsingOperation(rect, NSCompositeClear); ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Plea

UITableView scrolling & keyboard

2009-10-22 Thread Bob Barnes
Hi all, Apple's UICatalog sample iPhone app has a view demonstrating various styles of UITextFields and when one of the text fields is selected the table view scrolls the view if necessary to keep the chosen UITextField visible above the keyboard. I'd like to have the same capability

NSTextView is selectable even when selection is disabled

2009-10-22 Thread PCWiz
I have an NSTextView in a NSView (the prototype view of an NSCollectionViewItem), and the text view is bound to an NSAttributedString In interface builder both selectable and editable are disabled, however I can still select and edit the contents of the text view. What am I doing wrong? T

Help debugging "Dangling reference to an invalid object." Core Data error

2009-10-22 Thread Sean McBride
Hi all, Core Data is giving me a validation error when I try to save a document after making a simple change. I have an entity 'Scene' with a to-many relationship to an entity 'Target'. The inverse relationship is also to-many. Both relationships are optional and the delete rule for both sides

Professional Error Handling

2009-10-22 Thread Squ Aire
As my code base grows I'm starting to think there something wrong  with my error handling code. The following is my current error handling method: MODEL OBJECTS: I do methods in my MODEL objects, that could result in an error, like any normal person would, namely to have the famous "NSError *

Re: NSTextView is selectable even when selection is disabled

2009-10-22 Thread Dave Keck
"Conditionally Sets Editable"? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscr

Re: Professional Error Handling

2009-10-22 Thread Bryan Henry
Regarding your second case specifically, I usually define an error domain and error codes using an extern NSString* const plus an enum on a per-class basis. // This for the header extern NSString *const ExpressionProcessorErrorDomain; enum { EPUnmatchedParenthesesError = 21, EPRadix

Re: Professional Error Handling

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 4:40 PM, Squ Aire wrote: And then of course return NO or nil from the method. Is this how the professionals would do it? Basically, although I have a utility function that does most of the work, so I don't have to dump ten lines of boilerplate into my code every time

Re: Help debugging "Dangling reference to an invalid object." Core Data error

2009-10-22 Thread Melissa J. Turner
On Oct 22, 2009, at 16:26, Sean McBride wrote: > Hi all, > > Core Data is giving me a validation error when I try to save a document > after making a simple change. > > I have an entity 'Scene' with a to-many relationship to an entity > 'Target'. The inverse relationship is also to-many. Both

[SOLVED] Re: Displaying a view modally

2009-10-22 Thread Mike Manzano
Actually, I solved it myself, but it was similar to the solution you pointed me to. Thanks! The promo code is yours if you want it (it's a US promo code). Just email me at m...@instantvoodoomagic.com. Regards, Mike On Oct 21, 2009, at 5:54 PM, Saurabh Sharan wrote: Check out SFHudView b

The "correct" approach? Question about creating an NSMutableDictionary instance.

2009-10-22 Thread Michael de Haan
Let me start by saying I **think** I understand why my first approach did not work, but am interested if my working approach is correct in concept. Background. As a **very long** detour from Hillegass's chapter 18 challenge, I am following along with mmalc's excellent series of Binding ex

Re: The "correct" approach? Question about creating an NSMutableDictionary instance.

2009-10-22 Thread Graham Cox
On 23/10/2009, at 12:27 PM, Michael de Haan wrote: Let me start by saying I **think** I understand why my first approach did not work, but am interested if my working approach is correct in concept. Background. As a **very long** detour from Hillegass's chapter 18 challenge, I am follo

Re: The "correct" approach? Question about creating an NSMutableDictionary instance.

2009-10-22 Thread Michael de Haan
Graham...firstly thank you. I certainly did not try and make it harder...I **thought** I was making it easier to present what I thought was the crux of the issue. :-) So much for that thought! On Oct 22, 2009, at 6:47 PM, Graham Cox wrote: On 23/10/2009, at 12:27 PM, Michael de Haan wro

Re: The "correct" approach? Question about creating an NSMutableDictionary instance.

2009-10-22 Thread Graham Cox
On 23/10/2009, at 1:15 PM, Michael de Haan wrote: In words, ( also tried to do it diagrammatically...see below) In the dataSource object ( which in this case is a doc subclass) I have declared an array as an Ivar ( I called it "_record_list"). To this array, I added the object created in th

Re: The "correct" approach? Question about creating an NSMutableDictionary instance.

2009-10-22 Thread Michael de Haan
On Oct 22, 2009, at 7:33 PM, Graham Cox wrote: In words, ( also tried to do it diagrammatically...see below) In the dataSource object ( which in this case is a doc subclass) I have declared an array as an Ivar ( I called it "_record_list"). To this array, I added the object created in the A

NSDate timeIntervalSinceNow problem

2009-10-22 Thread PCWiz
In an NSDictionary I have a key called "time" that contains an NSDate object. When I NSLog the NSDictionary the time object appears like this: "time" = 2009-10-22 20:58:19 +; So what I did was this: // "myDict" represents the dictionary that contains the time key NSDate *time = [myDict o

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Stephen J. Butler
On Thu, Oct 22, 2009 at 10:06 PM, PCWiz wrote: > NSDate *time = [myDict objectForKey:@"time"]; > NSLog(@"%d", [time timeIntervalSinceNow]); > > And the result is this: > > 2009-10-22 21:01:18.949 TestApplication[8263:a0f] -2097072 > > Not sure what's wrong here, I've taken a look at some examples

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Kyle Sluder
On Oct 22, 2009, at 8:06 PM, PCWiz wrote: NSLog(@"%d", [time timeIntervalSinceNow]); From NSDate.h: typedef double NSTimeInterval; You need a %f, not a %d. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Sherm Pendley
On Thu, Oct 22, 2009 at 11:06 PM, PCWiz wrote: > > NSDate *time = [myDict objectForKey:@"time"]; > NSLog(@"%d", [time timeIntervalSinceNow]); > > And the result is this: > > 2009-10-22 21:01:18.949 TestApplication[8263:a0f] -2097072 > > Not sure what's wrong here, I've taken a look at some example

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Graham Cox
On 23/10/2009, at 2:06 PM, PCWiz wrote: NSLog(@"%d", [time timeIntervalSinceNow]); And the result is this: 2009-10-22 21:01:18.949 TestApplication[8263:a0f] -2097072 Not sure what's wrong here, I've taken a look at some examples and they seem to do the same thing. [NSDate timeIntervalSi

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Graham Cox
On 23/10/2009, at 2:10 PM, Stephen J. Butler wrote: The method returns a NSTimeInterval, which is a double, but the %d format is for integers. Awww, you spoiled the ending ;) Make 'em work for it! --Graham ___ Cocoa-dev mailing list (Cocoa-dev

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread PCWiz
Tried using %f to log it instead of %d, but it gives me this: 2009-10-22 22:01:55.459 TestApplication[8629:a0f] -2160.459210 On 2009-10-22, at 9:13 PM, Graham Cox wrote: On 23/10/2009, at 2:10 PM, Stephen J. Butler wrote: The method returns a NSTimeInterval, which is a double, but the %d fo

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread Graham Cox
On 23/10/2009, at 3:02 PM, PCWiz wrote: Tried using %f to log it instead of %d, but it gives me this: 2009-10-22 22:01:55.459 TestApplication[8629:a0f] -2160.459210 What did you expect to see? This reports that the date you've stored is 2160.45.. seconds earlier than now. Not unreasonab

Re: NSDate timeIntervalSinceNow problem

2009-10-22 Thread PCWiz
Had a little brain freeze for a second :P the negative sign had me a bit confused, my eyes generally associate long numbers with a negative sign as bad. Thanks for the clarification. On 2009-10-22, at 10:06 PM, Graham Cox wrote: On 23/10/2009, at 3:02 PM, PCWiz wrote: Tried using %f to

re: Help debugging "Dangling reference to an invalid object." Core Data error

2009-10-22 Thread Ben Trumbull
> Core Data is giving me a validation error when I try to save a document > after making a simple change. > > I have an entity 'Scene' with a to-many relationship to an entity > 'Target'. The inverse relationship is also to-many. Both relationships > are optional and the delete rule for both sid

Re: Textured sheet with tabview

2009-10-22 Thread John Joyce
Don't know if I did something wrong or this is a bug. [Leopard + Xcode 3.1.3] I thought I would make a (modal) sheet textured because it provided a nice contrast with its non-textured parent window. The sheet contains one Please review the HIG (human interface guidelines) in the docs. Th