trouble with method passing a value to a custom view
trouble with method passing a value to a custom view
- Subject: trouble with method passing a value to a custom view
- From: julia Cline <email@hidden>
- Date: Tue, 02 Jan 2007 04:36:42 -0800
I'm so new to Cocoa, I hope that I can make my question clear. Here's a try.
I have constructed a program that has two windows. One window is for entering general data about an experiment (things like experiment number, expermimenter, participant ID and characteristics). It is opened fromt he file menu item "new". The second window is also opened from the file menu with a duplicate "new" item. The second window contains a custom view that displays words that the participants respond to. Each word displayed and responded to represents a trial. I would like to be able to enter an integer in one of the textfields of the first window---the general information window---and "pass" that value to the window with the custom view--- as the number of trials to display. I have set up a method in the second window (with the custom view) that extracts the number properly, but only the method that extracts the number "knows" that value. The other methods in the custom view window report the value as zero. The code I am using is listed below. I have tried placing the "setnTrials" method in the .m file for the window that contains the custom view and in the custom view object---neither works. I believe that the problem has something to do with the initWithFrame method that initializes the custom view, but I'm not sure. In cae you are wondering, the int that receives the value in the setnTrials method is declared in the .h file. (I don't think the compiler would let me get away without including that anyway.) Any suggestions? Thanks, J
The code from the general information window is:
[nTrialsOut setnTrials: numberOfTrials];
The code form the window with the custom view is:
-(void)setnTrials:(int) nt;
{
nTrials=nt;
NSLog (@"\n************WVWindow*******after ntrials = %d\n",nTrials);
}
_______________________________________________
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