samaursa
19-02-2011 20:15:17
I am trying to select all the text (for faster input) when a textbox can receive keyboard input. I have a callback setup for that and it is being called properly. This is what I have in the callback though:
The code is being called, but it is not selecting the current text of the EditBox. What am I doing wrong and how can I have the text in the EditBoxbe automatically selected when a user clicks on that EditBox to type something (that is, when a user clicks on the EditBox, the text is automatically selected and the user can then start over-writing the old text without removing the old text first)
void MainState::EditBoxSelected( MyGUI::WidgetPtr aSender, MyGUI::WidgetPtr aOld )
{
MyGUI::EditBox* lEdit = aSender->castType<MyGUI::EditBox>();
lEdit->setTextSelection(0, lEdit->getCaption().size() - 1);
}
The code is being called, but it is not selecting the current text of the EditBox. What am I doing wrong and how can I have the text in the EditBoxbe automatically selected when a user clicks on that EditBox to type something (that is, when a user clicks on the EditBox, the text is automatically selected and the user can then start over-writing the old text without removing the old text first)