• 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: changing the text in an NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing the text in an NSTextField


  • Subject: Re: changing the text in an NSTextField
  • From: publiclook <email@hidden>
  • Date: Tue, 1 Jul 2003 10:05:32 -0400

Drag a label from IB and connect it to an outlet in some other object. Just use -setStringValue: to change the label text.

A label is just an NSTextField that is enabled but not selectable or editable. Of course, I think all text should be selectable because you never know what some user may want to select and copy. Maybe that want to copy the text of a label so they can paste it in a tech support e-mail...

What made you think -setStringValue: wouldn't work ?

- (void)setStringValue:(NSString *)aString
Sets the value of the receivers cell (or selected cell) to the string aString. If the cell is being edited, it aborts all editing before setting the value; if the cell doesnt inherit from NSActionCell, it marks the cells interior for automatic redisplay (NSActionCell performs its own updating of cells).

See Also:  setDoubleValue:,  setFloatValue:,  setIntValue:,  setObjectValue:,  stringValue



On Tuesday, July 1, 2003, at 09:28 AM, Michael George wrote:

I have an interface which I've built with IB. I have a pair of buttons with text preceding them and I would like to programmatically change that text on the screen depending on what the buttons will be indicating.

I don't want the text editable or even selectable, I just want to change the string/title and be able to affect the change to the > screen.

I have looked at the methods available for NSTextField and I cannot find anything which does this. NSTextView seems to be more amenable to changing the string, but IB doesn't have an object for that.

It seems a very simple thing to want to do, so I'm guessing that the way I think it would be done is not the way it *should* be done and that if I find the "Cocoa way" it will be very straightforward...

Thanks!
-Michael
_______________________________________________
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.

  • Follow-Ups:
    • Re: changing the text in an NSTextField
      • From: Michael George <email@hidden>
References: 
 >changing the text in an NSTextField (From: Michael George <email@hidden>)

  • Prev by Date: Re: Undefined symbols in C++ project
  • Next by Date: [OT}Re: Strong language about Cocoa and Qt.
  • Previous by thread: changing the text in an NSTextField
  • Next by thread: Re: changing the text in an NSTextField
  • Index(es):
    • Date
    • Thread