开发者

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 som开发者_Go百科ething 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


Probably you're looking for the RichTextArea widget

You can check the documentation here: RichTextArea

And an old, but nice tutorial here: Tutorial


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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜