WelcomeTo
WelcomeTo

Reputation: 20571

Show Tree component when click on TextBox

On UI I have a TextBox. I want to show Tree element when user clicks on TextBox. I want to prevent user from direct input text to TextBox (it's value must depend which item user select from Tree) enter image description here

Upvotes: 0

Views: 172

Answers (2)

Jama A.
Jama A.

Reputation: 16079

Set ReadOnly attribute for your textbox, and for your tree widget addSelectionHandler

tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        public void onSelection(SelectionEvent<TreeItem> event) {
                  textbox.setText(event.getSelectedItem().getText()); 
        }
  });

Upvotes: 2

devzero
devzero

Reputation: 2670

You should use this attribute: http://www.w3schools.com/tags/att_input_readonly.asp

Upvotes: 1

Related Questions