// static void FSPanelLogin::giveFocus() { if( sInstance ) { // Grab focus and move cursor to first blank input field std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString(); std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString(); BOOL have_username = !username.empty(); BOOL have_pass = !pass.empty(); LLLineEditor* edit = NULL; LLComboBox* combo = NULL; if (have_username && !have_pass) { // User saved his name but not his password. Move // focus to password field. edit = sInstance->getChild<LLLineEditor>("password_edit"); } else { // User doesn't have a name, so start there. combo = sInstance->getChild<LLComboBox>("username_combo"); } if (edit) { edit->setFocus(TRUE); edit->selectAll(); } else if (combo) { combo->setFocus(TRUE); combo->focusEditor(); } } }