• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Create an IB "Informational Text" field Programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Create an IB "Informational Text" field Programatically (From: Bryan Rieger <email@hidden>)

  • Prev by Date: copy and deepcopy
  • Next by Date: Re: copy and deepcopy
  • Previous by thread: Create an IB "Informational Text" field Programatically
  • Next by thread: Toolbar item like Finder 'view' item
  • Index(es):
    • Date
    • Thread