RE: matching interface builder object to source
RE: matching interface builder object to source
- Subject: RE: matching interface builder object to source
- From: email@hidden
- Date: Thu, 22 Jan 2004 10:21:45 -0000
Hi Matthew,
I do a similar thing in a test app I have, I rolled a method in my
controller to append text to a NSTextView and scroll the view to ensure the
end text remains in view:
- (void) appendTextView:(NSTextView *)textView withString:(NSString *)string
{
int length = [[textView string] length];
[textView replaceCharactersInRange:NSMakeRange(length,0)
withString:string];
length += [string length];
[textView scrollRangeToVisible:NSMakeRange(length,0)];
}
HTH
Alun Carp
Driver Development Team Leader
Data Encryption Systems Limited
-----Original Message-----
From: email@hidden
[
mailto:email@hidden] On Behalf Of Matthew Cook
Sent: 21 January 2004 18:15
To: email@hidden; email@hidden
Subject: matching interface builder object to source
I've just recently moved into Cocoa after working in java Swing for a while,
and it's a bit of an adjustment, but I really like this ease of laying out
interface components with Interface Builder. I've been through a few
cocoa/objective-c books but I'm a little fuzzy on how best to access user
interface objects programatically.
For example, in one interface I have a large NSTextView that will act
something like a scrolling console with messages added to the bottom from
time to time. I've had no issue setting up an IBOutlet object in my
controller class and correctly displaying the strings, but I need to access
the NSScrollView (more specifically the NSClipView) of the NSTextView so
that I can tell it to scroll down when new lines are added to the console.
If I just put an instance of an NSScrollView in my controller class, can I
somehow reference the NSScrollView from the IBOutlet NSTextView object? Can
I instantiate an NSScrollView in Interface Builder and somehow connect it to
the NSScrollView that comes with the NSTextView?
Should I just try and create, place and draw the whole NSScrollView and
TextView programatically? Should I create a spicific NSScrollView in
Interface Builder and place a NSTextView inside it, or will this make an
NSTextView in an NSScrollView in an other NSScrollView?
Any clarification would be appreciated. Thanks in advance.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.