GLBasic forum

Main forum => GLBasic - en => Topic started by: mentalthink on 2016-Jul-14

Title: How I can count the characters of Input command
Post by: mentalthink on 2016-Jul-14
Hi guys, sorry if this was comment in the forum, but I don't remind how done this.
Code (glbasic) Select


IF LEN(self.button_Name$ )<7

     INPUT self.button_Name$  , self.x, self.y+50

ENDIF


Basically I want do , using input command, I only can write N( 7 ) characters.

Thanks
Title: Re: How I can count the characters of Input command
Post by: MrTAToad on 2016-Jul-14
DEBUG (or use PRINT) LEFT$(self.button_Name$,7)
Title: Re: How I can count the characters of Input command
Post by: mentalthink on 2016-Jul-14
Thanks mrT
Title: Re: How I can count the characters of Input command
Post by: msx on 2016-Jul-14
Why not use INKEY$?. So, you could filter the characters entered in real time.

Code (glbasic) Select
GLOBAL name$, N=7, letter$

WHILE LEN(name$)<=N
letter$=INKEY$()
name$=name$+letter$
PRINT name$+"_",0,0
SHOWSCREEN
WEND
Title: Re: How I can count the characters of Input command
Post by: erico on 2016-Jul-14
Nice, I was wondering about that too.
Title: Re: How I can count the characters of Input command
Post by: MrTAToad on 2016-Jul-14
INKEY would indeed be the more professional way of doing it.
Title: Re: How I can count the characters of Input command
Post by: mentalthink on 2016-Jul-14
Thanks MSX I don't thought-out, really this is I need.

The problem in input you can't say the max number of chars...

Thanks a lot.  :booze: