Barry
Barry

Reputation: 1665

GWT TextBox widget

I have a well populated Object which has properties like color,size,weight etc. I need to get these object properties and place them in a TextBox.

So i want to do something like

   `textBox.getLine1.setText(Object.getColor());
    textBox.getLine2.setText(Object.getWeight());`

That is i need a textBox in which i can edit individual lines.

I am planning to have a widget which has a FlexTable inside the TextBox but i am not sure how to work on it.

Can someone please help me on this?

Thanks

Upvotes: 0

Views: 683

Answers (3)

ramon_salla
ramon_salla

Reputation: 1607

I did something similar: I needed to let user select one or several text rows and let each row be clickable to perform an action.

So I used a VerticalPanel with Labels.

VerticalPanel labelPanel = new VerticalPanel();

For a given index Label:

Label selectedLabel = (Label) labelPanel.getWidget(index);
DOM.setElementAttribute(selectedLabel.getElement(), "id", "label-selected");

CSS code as you wish!

Upvotes: 0

Carlos Tasada
Carlos Tasada

Reputation: 4444

Probably you're looking for the RichTextArea widget

You can check the documentation here: RichTextArea

And an old, but nice tutorial here: Tutorial

Upvotes: 1

Gipsy King
Gipsy King

Reputation: 1577

If you must use a TextArea, which is a standard <input type="text"> element, you would have to find line breaks and create a Selection, and then replace it with whatever you want. You could also read the entire text, change it, and then update the entire TextArea value again.

I would recommend splitting your widget into multiple single line TextBoxes.

Upvotes: 0

Related Questions