Textfield scrollbar

Hello,

when setting the height of a textfield. its displayed with a scrollbar at the right side. no matter what height i choose.

any ideas why?!? how do i disbable those scrollbars in Textfields. btw. imho there is no need for a scrollbar in a textfield.

thanks

steff

Most likely it is the browser that by default shows the scrollbar, no matter what. A little bit of CSS might fix it, dunno. What browser are you using?

hi,

thanks for replay. i am afraid the problem is with every common browser i tested.

i have it like this:



		// loginnameTextField
		loginnameTextField = new TextField();
		loginnameTextField.setImmediate(false);
		loginnameTextField.setWidth("176px");
		loginnameTextField.setHeight("23px");
		mainLayout.addComponent(loginnameTextField, "top:40.0px;left:104.0px;");

		// passwordTextField
		passwordTextField = new PasswordField();
		passwordTextField.setImmediate(false);
		passwordTextField.setWidth("176px");
		passwordTextField.setHeight("23px");
		mainLayout.addComponent(passwordTextField, "top:65.0px;left:104.0px;");

while the field loginnameTextField is displayed with scrollbars and passwordTextField not ?!?
i dunno why. what css should i try to fix it?

thanks again

steffan

Well that’s strange, that they behave differently even with the same dimensions. But they are two different browser element types, input[text]
and input[password]
, so there might still be some browser specific rendering issues that cannot be adjusted with CSS. But you can always try forcing overflow: hidden; on the textfield element:

.v-textfield {
overflow: hidden !important;
}

Actually, the cause for the difference is that TextField changes to a TextArea when setting its height (old, deprecated compatibility code - should use TextArea nowadays if multiple rows are needed) whereas a PasswordField does not.

Workaround to make a TextField single-line when setting the height (untested and uses deprecated API that may get removed from future versions): call tf.setRows(0) right after tf.setHeight(…).