Closed gml16 closed 4 years ago
I see your point, but in my opinion I think that is a decent way of handling it.
The alternative ways would have been to create an additional boolean member, or have a separate const string somewhere for defining the default available characters. (There might be other ways too, this is all I can think of for now though).
Happy to merge this, thanks for the contribution! :)
This addresses #180 . I have added to the Lua API
textBox:limitChars("123456789")
(which in this case would only allow digits from 1 to 9 to be entered) as well astextBox:allowAllChars()
(which resets the chars that had been previously prevented). I store the authorised chars instd::string m_charsAuthorised
and, this may not be a good design choice, if the field is an empty string it considers all chars to be authorised. Thus,textBox:allowAllChars()
is basically callingtextBox:limitChars("")
. Tell me what you think.