コード例 #1
0
// static
void LLPanelLogin::giveFocus()
{
#if USE_VIEWER_AUTH
	if (sInstance)
	{
		sInstance->setFocus(TRUE);
	}
#else
	if( sInstance )
	{
		// Grab focus and move cursor to first blank input field
		std::string first = sInstance->getChild<LLComboBox>("name_combo")->getTextEntry();
		std::string pass = sInstance->childGetText("password_edit");

		BOOL have_first = !first.empty();
		BOOL have_pass = !pass.empty();

		if (!have_first)
		{
			// User doesn't have a name, so start there.
			LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo");
			combo->setFocusText(TRUE);
		}
		else if (!have_pass)
		{
			LLLineEditor* edit = NULL;
			// User saved his name but not his password.  Move
			// focus to password field.
			edit = sInstance->getChild<LLLineEditor>("password_edit");
			edit->setFocus(TRUE);
			edit->selectAll();
		}
		else
		{
			// else, we have both name and password.
			// We get here waiting for the login to happen.
			LLButton* connect_btn = sInstance->getChild<LLButton>("connect_btn");
			connect_btn->setFocus(TRUE);
		}
	}
#endif
}