Sorry for the thread topic, I couldn't think of anything better
I am trying to learn Cocoa and wanted to create a simple program that has a button and an NSTextField. When the button is pressed I wanted text to fill the NSTextField by scrolling into it. Anyway, here is the code from the Class I created to control the window.
- (IBAction)start

id)sender
{
[NSTimer scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(changeText)
userInfo:self
repeats:YES];
}
- (void)changeText
{
NSString *textStringData = @"Scrolling Text";
NSMutableString *intermediateStringData
int stringLength = [textStringData length];
int x;
for (x = 0; x < stringLength; x++)
{
[intermediateStringData characterAtIndex:x] = [textStringData characterAtIndex:x];
[textField1 setStringValue: intermediateStringData];
}
}
@end
I get four build errors:
-Nested functions are not supported on MacOSX for the line "int stringLength = [textStringData length];
-'stringLength' undeclared for the line "for (x = 0; x < stringLength; x++)"
-'intermediateStringData' undeclared for the line "[intermediateStringData characterAtIndex:x] = [textStringData characterAtIndex:x];"
I am new, so please be gentle
