Setting Input string limitations

Blitz3D Forums/Blitz3D Beginners Area/Setting Input string limitations

AvestheFox(Posted 2009) [#1]
Say like I want to limit the input of a name to 10 characters (to fit the input field) what would I need to do?


Matty(Posted 2009) [#2]
Name$=Trim(Lset(Name$,10))


AvestheFox(Posted 2009) [#3]
Perhaps I should have been a bit more specific on this (though your help is greatly appreciated, thanks, Matty :) )

I wish to limit the amount of text that can be typed. The problem is, is that I cant seem to put a stopper on the input text while the input is active.

I hope that makes sense...


Matty(Posted 2009) [#4]
You could write your own "input" function rather than using the 'default' input function?

If you are using some kind of external gui lib I cannot offer any other advice.

However by combining

http://blitzbasic.com/codearcs/codearcs.php?code=207

with the line "if length>10 then return astring$" in the relevant spot in that function linked it should work.


AvestheFox(Posted 2009) [#5]
Thanks :)

I'll certainly study that code