Re: Clicking in an attributed TextField
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