• 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: Clicking in an attributed TextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clicking in an attributed TextField


  • Subject: Re: Clicking in an attributed TextField
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sun, 10 Feb 2008 12:29:30 +0700

Date: Sat, 9 Feb 2008 16:52:39 +0700
From: "Gerriet M. Denkmann" <email@hidden>

I have (10.4.11) a very simple app, which has one window with one
NSTextField (selectable, not editable) and one NSButton.
When I click the button, a colourful text is put into the textfield
([ textField setAttributedStringValue: colouredString ]).

The textField has no fieldEditor ( [ testWindow fieldEditor: NO
forObject: textField ] == nil ).

So far all is fine.

Now, when I click in the textField, a fieldEditor is created (an
NSTextView).
But:
None of the attributes of my colouredString gets copied into the
textStorage of the fieldEditor. It just uses the default system font
(LucidaGrande 13pt.) and the system text colour (black).

How can this be avoided?

Easily, by calling [textFiled setAllowsEditingTextAttributes: YES] before it is used (e.g. in awakeFromNib).
This has the additional benefit that the font panel will show the selected font in the text field.


The documentation (at least in Tiger) iimplicitly assumes editable NSTextFields and says nothing about non-editable but selectable text fields.

Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: references to controllers in document based applications
  • Next by Date: Re: Memory management with arrays
  • Previous by thread: Clicking in an attributed TextField
  • Next by thread: Show Image above Keynote presentation
  • Index(es):
    • Date
    • Thread