I have set my text area to use a certain font (in the inspector), but any pasted text from the clipboard overrides it, and changes the font.
I guess this is expected, but is there any way to prevent this?
If not, what is the best way to set it back to the defined font for the text area, and which is the best event to put this?
Thank you all in advance.
I think it is this property:
Controls whether the receiver allows the user to change font attributes of the receivers string.
@property BOOL allowsEditingTextAttributes
If YES, and the text value is an attributed string, it is displayed using the attributed strings visual settings, which can be modified in the font panel.; if flag is NO and the text is an attributed string. the string attributes (font, color, etc.) are ignored and the string is displayed based on the text fields settings. Setting the attributed strings attributes are ignored when displaying the string and when the text field is editing.[/quote]
Do you use any OS X Lib extension or your own declares? A Xojo textfield does not offer access to this property without.
I have macoslib in my app, but I simply set the text area’s font to Arial in the inspector.
This will not work as TextArea is an NSTextView, not an NSTextField.
Do you need declares for that?
You could just implement your own paste menu handler and paste text only.
Oh sorry, wrong control. And Christian is right otherwise I would try setRichtext = False.
It doesn’t matter to me how I do it - so long as I can do it
I have just noticed a “Styled” switch in the inspector - I think that might be what I need?
if you want whole textfield/textarea without style, setting it to off may work.
Yes, that’s what I did, and now it seems to be working fine