Re: trouble with method passing a value to a custom view
Re: trouble with method passing a value to a custom view
- Subject: Re: trouble with method passing a value to a custom view
- From: julia Cline <email@hidden>
- Date: Tue, 02 Jan 2007 06:23:38 -0800
Thank you for responding.
1) I'm trying to learn the correct terminology and I thought that I had been more specific with this e-mail. I just received the treatise on how to ask a good question and have reviewed that. I have been using online and print resources before posting. My husband---who is much better than I am at Objective-C, is stumped on this one too. So I did consult a friend who knows more first, as the guide suggested.
2) I have created an outlet in myCustomView. I have tried to use the "setnTrials " method to pass the value from both a dataObject (subclass of NSObject) and another window (descriptiveDataWindow, subclass of NSWindow) without success. I have successfully passed the value from the subclass of NSWindow (descriptiveDataWindow) to the subclass NSObject (dataObject), but my attempts to pass the value from either of those sources to the customView (subclass of NSView) or to the window that displays the view (subclass of NSWindow) have failed---or rather, partially failed, only the setnTrials method "sees" the value. I've included NSLog statements in the other methods of the NSView subclass to check the value of the int variable that is receiving the value from the outlet. All other methods indicate that the value is zero. I do transfer the value before these methods are implemented, so I'm stumped as to why they don't display the updated value in the NSLog statement.
3) I guess that if my questions are too low-level, i will desist from the list. I don't intend to annoy and i understand why higher-level questions are more interesting to those who use this list.
Thanks for your time,
J
On Tuesday, January 02, 2007, at 05:44AM, "I. Savant" <email@hidden> wrote:
>Julia:
>
>
>On Jan 2, 2007, at 7:36 AM, julia Cline wrote:
>> Any suggestions?
>>
>
> Just four ... :-)
>
>1 - You're going to need to take the time to read and learn the
>correct terminology or getting help from others is going to be a
>along, arduous process. Unless you really mean you've subclassed an
>NSWindow and added an instance method called "setnTrials:" you
>probably mean you have a controller object (like "MyAppController.m")
>or an NSDocument subclass (by default, "MyDocument.m"). You need to
>specify which.
>
>2 - If you're trying to call the method -setnTrials: from one
>controller and it's in another controller / view / object-in-general,
>you can create an IBOutlet in that controller and connect it to the
>target object. Example: You have an NSDocument subclass (MyDocument)
>and in your nib, you have a custom view. In your MyDocument.h you
>must create an outlet:
>
> IBOutlet id myCustomView;
>
>... then from within MyDocument.m, you can send your custom view a
>message like:
>
> [myCustomView setnTrials:someIntegerValue];
>
>3 - With respect, I think you're putting the cart before the horse,
>so to speak. You would do well to get yourself a Cocoa book and
>follow a more structured course on Cocoa / Objective-C. Search this
>list's archives for *many* threads suggesting various books.
>
> You should also read the Cocoa Fundamentals Guide here:
>
>http://developer.apple.com/documentation/Cocoa/Conceptual/
>CocoaFundamentals/index.html
>
> Also, go over the "Cocoa Application Tutorial":
>
>http://developer.apple.com/documentation/Cocoa/Conceptual/
>ObjCTutorial/index.html
>
> Go over these until you thoroughly understand them. Those two
>alone will go a long way toward helping you understand how to
>structure your application and get its various parts talking together
>the "Cocoa Way" (and believe me, not doing things the Cocoa Way in a
>Cocoa application with Cocoa objects is 99.9% of the time a *bad*
>design choice).
>
> I hope this helps.
>
>--
>I.S.
>
>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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 Subscription:
This email sent to email@hidden