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: "I. Savant" <email@hidden>
- Date: Tue, 2 Jan 2007 10:13:49 -0500
On Jan 2, 2007, at 9:23 AM, julia Cline wrote:
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.
I actually chuckled at the timing of the moderator's monthly post
of the list guidelines. It came in just as I was replying to your
message. :-)
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.
Out of context, it's not really clear how or why things are wired
up from your description. For example, why are you subclassing
NSWindow? Unless you're trying to change the behavior of the window
your custom view is in, this is unnecessary. If you're subclassing
NSWindow just to have a place to put methods that deal with what's
displayed *in* the window, then you've missed crucial Cocoa concept.
This is why I suggested reading the guides I mentioned - it sounds
like you don't yet grasp the Model/View/Controller design concept,
upon which Cocoa is built. Going against the grain there (without
knowing exactly when and why it's okay to do so) will mean certain
confusion and result in a jumbled mess. :-)
It'd be best if you could post fuller code listings (complete with
the names of the files from which they come, so others can keep it
straight). Better yet, you could zip up your whole XCode project
folder and post it somewhere for us to examine. It'd be a lot easier
to see what you're referring to and offer comments / suggestions.
Without more concrete details, however, there isn't much hope of
making sense of the problem you're having.
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.
Nonsense.
This list is for beginners as well as experts. I'd call myself
somewhere in between, but certainly no expert. If you've never used a
developer's mailing list before, you should take a look through this
list's archives to see how others post their questions (the good with
the bad) - that'll give you a good idea of what is needed and what is
commonly left out. As long as you read the documentation you're
pointed to, nobody will get annoyed if you ask for further
clarification.
The bottom line is this - we're not familiar with your project. We
may make assumptions in absence of information and give you the wrong
advice. The best thing for you to do is to give as much information
as you possibly can. If someone tells you there's not enough
information, it's not an insult, just a request for more
information. :-)
The above said, I'll reiterate the important parts:
1 - You *really* need to master the content of the two documents I
referred you to. The more you describe the problem, the clearer it
becomes that you're missing/misunderstanding some of the
fundamentals. Every Cocoa developer has been there -- we all had to
walk before we could run.
2 - In order to offer solid suggestions, we're really going to have
to see more. If you're not sure what code we need to see, it might be
easier just to post a link to a copy of your project so we can
download it and take a look at the whole, big picture.
--
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