MCPcopy Create free account
hub / github.com/crossuo/crossuo / OnTextInput

Method OnTextInput

src/Gumps/GumpTextEntryDialog.cpp:115–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void CGumpTextEntryDialog::OnTextInput(const TextEvent &ev)
116{
117 const auto ch = EvChar(ev);
118 if (Variant == 2) // Only numbers
119 {
120 if (ch >= '0' && ch <= '9')
121 {
122 g_EntryPointer->Insert(ch);
123 const int val = str_to_int(g_EntryPointer->GetTextA());
124 if (val > m_MaxLength)
125 {
126 g_EntryPointer->Remove(true);
127 }
128 else
129 {
130 WantRedraw = true;
131 }
132 }
133 }
134 else if (Variant == 1) // Anything, but limited in length
135 {
136 if ((int)g_EntryPointer->Length() < m_MaxLength)
137 {
138 g_EntryPointer->Insert(ch);
139 WantRedraw = true;
140 }
141 }
142}
143
144void CGumpTextEntryDialog::OnKeyDown(const KeyEvent &ev)
145{

Callers

nothing calls this directly

Calls 5

str_to_intFunction · 0.85
LengthMethod · 0.80
InsertMethod · 0.45
GetTextAMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected