How to limit the input length for a text label
-
Hi guys,
Does anybody know of a way to set the maximum number of characters that can be inputted into a HISE label (set to editable)?
I've searched the forum but can't seem to find anything on this.
I'd imagine that I could achieve it using a timer somehow, but hoped that there would be a more elegant way.
Please share if you have any ideas.
Cheers,
Lee
-
@LeeC If the label's callback is triggered when entering text you could check the string length and delete any additional characters the user tries to enter.
-
@d-healey I like your thinking.
I don't think that label callbacks are triggered when text is entered, which is why I was thinking about using a timer.Also, have you got any thoughts on how to delete the the additional characters that exceed the
MaxTextLength
? -
Callback is triggered when you hit enter (or you could trigger it manually, from a button for example).
HiseSnippet 806.3ocsUstaSCCE1tqAsFnHlDO.Q6WoRipjcGMALVufp1sJ5Xh+M4l31ZMG6nDmwpl1KCuL75va.bbR5R6naZqRjekykO6Oe7243tQROZbrLBgqb13PJB+JidiEpQMFQXBTmlH7qMNlDqnQVYtNXbHINl5iv3k9h1AtRYT52u+zADNQ3QKbgPmKYdziXALUg2t6eHiyaS7omwBlJ6M2uimTzPxkI.eVxvAER7tjLjdBQmVICD9Es7YJYTOEQQigbNP5Ot2H4ODY4eNKl0mS0FtndvBk4F0XDi62cxYMFgvk6VbxWJ6j+ViiY9r67WTAdSZ.qBDSWCvklkRkmgRtODkZK495E3AnGdJ5UNidqXzyKhEpJhn41KM5HfKmADnrOMsxxEU5WXiFRHCgpd.4RZ6Hv3ND1a63rl0VNN01qpYUSn3GqrthDYcDoOk6Z8AqIXGRUMjAgRAXXuZV3UyPwDblfZMHQ3oXRgkTjEVCMRxs8lfaMXo4IzZUMuopYE1.K6T65bpXnZj0GsbcfXUrfu6vTOlB6mhdsZ0b30iS5GqhXhg1.2AHZVbaJSdbxpWpbN0fv48Aok883Zs8l5TbhTQOUXWy7FyJl2ZZc+PCFL2X4KEmFM2vZEeziAzVjDzmFMoXMIQPFLqN6EOMclWVMYpDkhNBl5zPZtcgRzcNJQTdQE96acZRTDs3L2GjWHMRwzzA2jdEzomIUqXzjFeoRFlla9MABanRiVMWHmV5QLXqW1H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