PDA

View Full Version : TextField as ContentPanel Header tool has text selection issues



batkins
20 Aug 2010, 1:33 PM
When I add a TextField<String> to a ContentPanel header using insertTool(textField, 0), the text fieldappears and functions normally, except that no selection highlighting is happening. Selecting on focus, or selecting with the mouse or keyboard fails to hightlight the text, but the text is selected (for example, selecting two characters with the keyboard and clicking delete does delete two characters as expected).

In addition, the blinking text cursor does not appear when the field is clicked on (the cursor is an text i-beam cursor, btw), but it does appear when text is actually typed. The cursor does not move with the selection either by keyboard or mouse.

One thing that could be contributing to the problem is the height of the TextField, which is greater than the height of the containing element (the ContentPanel header). I tried setting the TextField height, but that is being ignored, perhaps because of the text style. What controls the height of a TextField?

Any help on why this is happening would be most welcome.
Thanks!

sven
20 Aug 2010, 5:32 PM
The header has disabled the textselection. You need to enable it again.

cp.getHeader().disableTextSelection(false);

You need to call this after rendering. So best would be to add a Render event listener to the contentpanel and do this action in there.

batkins
23 Aug 2010, 5:09 AM
The header has disabled the textselection. You need to enable it again.

cp.getHeader().disableTextSelection(false);

You need to call this after rendering. So best would be to add a Render event listener to the contentpanel and do this action in there.

Sven,

Thanks! That was exactly what I needed!