Re: Create an IB "Informational Text" field Programatically
Re: Create an IB "Informational Text" field Programatically
- Subject: Re: Create an IB "Informational Text" field Programatically
- From: Vince DeMarco <email@hidden>
- Date: Mon, 22 Apr 2002 16:12:59 -0700
On Monday, April 22, 2002, at 12:43 PM, Bryan Rieger wrote:
How do I create an NSTextField that is the same as IB's "Informational
Text" field at run time?
I can do this to get IB's "Message Text" field.
NSRect labelRect = NSMakeLabelRect( 10.0, 10.0 , 100.0, 22.0 );
NSTextField * labelField = [[NSTextField alloc] initWithFrame: labelRect];
[labelField setBordered: NO];
[labelField setBezeled: NO];
[labelField setSelectable: NO];
[self addSubview: labelField];
But this does not work for IB's "Informational Text"
SRect labelRect = NSMakeLabelRect( 10.0, 10.0 , 100.0, 14.0 );
NSTextField * labelField = [[NSTextField alloc] initWithFrame: labelRect];
[labelField setBordered: NO];
[labelField setBezeled: NO];
[labelField setSelectable: NO];
[self addSubview: labelField];
The text ends up bigger than the display rect.
Try setting the font too.
[labelField setFont:[[NSFont systemFontOfSize:[NSFont systemFontSize]]]
vince
_______________________________________________
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.