quote:
Originally posted by GNSPS
Yes, there is a way to limit the amount of characters to enter in a textbox in a MP!L window, all you have to do is to edit the XML file or the script's code in order for them to don't allow more characters than those specified.
IIRC there is no way to specify the maximum amount of characters you can enter in an EditControl directly in the XML; there are no attributes for it.
However, you can specify the maximum amount by sending the
EM_SETLIMITTEXT or
EM_LIMITTEXT windows message (both are identical) to the control by using the Plus! scripting function:
PlusWnd::SendControlMessage.
See
Official Plus! Scripting Documentation.
eg:
code:
// create window with id 'Information'
var wndExample = MsgPlus.CreateWnd('interface.xml', 'Information');
// send windows message EM_LIMITTEXT (constant value 0xC5) to the control with id 'PhoneNumber'
wndExample.SendControlMessage('PhoneNumber', 0xC5 /* EM_LIMITTEXT */, 9 /* maximum allowed characters */, 0 /* not used */)