| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
NeXTSTEP Text objects supported scrollToSel, but that functionality appears
to be gone from the new NSText and NSTextView classes.
I am attempting to scroll an NSTextView object to the bottom. Here is my
sample code. It doesn't work:
- (IBAction)addLines:(id)sender
{
int i;
float height;
for(i=0;i<100;i++){
NSString *str = [NSString stringWithFormat:@"Here is another line,
#%d\n",i];
int len = [[theText string] length];
[theText
replaceCharactersInRange:NSMakeRange(len,0)
withString:str];
}
if([theText isFlipped]){
NSLog(@"theText is flipped");
}
/* Now scroll to see the last line */
height = [theText frame].size.height;
NSLog(@"Attempting to scroll to 0,%f in frame",height);
if([theText scrollRectToVisible:NSMakeRect(0,height-1,1,1)]){
NSLog(@"Scrolling was performed");
}
}
@end
You'll note that this code verifies that theText is flipped (so the
lower-left is 0,height-1, and not 0,0). But no scrolling happens. Anybody
have a clue?
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
| References: | |
| >scrolling an NSText to the bottom (From: "Simson Garfinkel" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.