Pressing enter key when entering client address automatically connects.

This commit is contained in:
Bartosz Taudul 2018-12-22 17:12:33 +01:00
parent cd8d86edf3
commit e1bd5c092b

View File

@ -274,7 +274,8 @@ int main( int argc, char** argv )
} }
ImGui::Separator(); ImGui::Separator();
ImGui::Text( "Connect to client" ); ImGui::Text( "Connect to client" );
ImGui::InputText( "", addr, 1024 ); bool connectClicked = false;
connectClicked |= ImGui::InputText( "", addr, 1024, ImGuiInputTextFlags_EnterReturnsTrue );
if( !connHistVec.empty() ) if( !connHistVec.empty() )
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -302,7 +303,8 @@ int main( int argc, char** argv )
ImGui::EndCombo(); ImGui::EndCombo();
} }
} }
if( ImGui::Button( ICON_FA_WIFI " Connect" ) && *addr && !loadThread.joinable() ) connectClicked |= ImGui::Button( ICON_FA_WIFI " Connect" );
if( connectClicked && *addr && !loadThread.joinable() )
{ {
std::string addrStr( addr ); std::string addrStr( addr );
auto it = connHistMap.find( addr ); auto it = connHistMap.find( addr );