NeoRamza
NeoRamza

Reputation: 151

NSTextField auto increase width when not editable

I am making a mac osx app using Xcode/cocoa. In this app, there is a NSTextField which displays a text when a button is pressed. When the textfield is in editable behavior everything works fine, but this textfield should not be editable. The problem is that when the text is too long to be full displayed in the textfield and the textfield is not editable, the width is automatically enlarged to fit the text. What I should do to the textfield dont resize even in disabled or selectable behavior?

Upvotes: 0

Views: 530

Answers (1)

Anoop Vaidya
Anoop Vaidya

Reputation: 46543

"What I should do to the textfield dont resize even in disabled or selectable behavior?" This behavior is given by Apple itself... you can change its behavior but it will go against the UI guidelines of Apple. So I would say please stick to the default behavior. Or for learning process you can override the NSTextField and implement AutoLayoutSizing's methods. Also you can do it with Constraints provided in if-else.

Upvotes: 1

Related Questions