Ticket #3651: cinput_maximum_length.patch
File cinput_maximum_length.patch, 1.3 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml
80 80 <translatableAttribute id="caption">Server name:</translatableAttribute> 81 81 </object> 82 82 83 <object name="hostServerName" type="input" size="50%+10 80 100%-20 104" style="ModernInput" >83 <object name="hostServerName" type="input" size="50%+10 80 100%-20 104" style="ModernInput" max_length="48"> 84 84 <action on="Load"> 85 85 this.caption = getDefaultGameName(); 86 86 </action> -
source/gui/CInput.cpp
110 110 CStrW* pCaption = (CStrW*)m_Settings["caption"].m_pSetting; 111 111 std::wstring text = wstring_from_utf8(ev->ev.text.text); 112 112 113 // check max length 114 int max_length; 115 GUI<int>::GetSetting(this, "max_length", max_length); 116 if (max_length != 0 && (int)pCaption->length() + text.length() > max_length) 117 return IN_HANDLED; 118 113 119 m_WantedX = 0.0f; 114 120 115 121 if (SelectingText())