-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getTotalAreaWidthEstimate() #1198
Comments
For a single line of text you could try the following: var tf = new InlineCssTextField( "Test" );
tf.maxWidthProperty().bind( Bindings.createDoubleBinding( () ->
{
var charBounds = tf.getCharacterBoundsOnScreen( 0, tf.getLength() );
if ( charBounds.isEmpty() ) return tf.getPrefWidth();
var pad = tf.getInsets();
var width = charBounds.get().getWidth();
return pad.getLeft() + width + pad.getRight();
},
tf.lengthProperty(), tf.insetsProperty() )); I've opened a discussion area here, see if that works. I've never used it before, so ..... ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using InlineCssTextArea, and as characters are added, I wish to enlarge the area and the box that contains it so that all the characters are shown. And shrink it when characters are deleted. The box must be a tight boundary for the area's contents. I thought area.get TotalWidthEstimate() might be the way to measure the width of the contents, but it returns 15.0 no matter what is in the area. The area's preferred width is 64. Is there something I should call to get a valid total width? Is this documented anywhere? And is there a forum for questions like this so it is not flagged as an Issue? Thanks.
The text was updated successfully, but these errors were encountered: