How I can count the characters of Input command

Previous topic - Next topic

mentalthink

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

MrTAToad

DEBUG (or use PRINT) LEFT$(self.button_Name$,7)

mentalthink


msx

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

erico

Nice, I was wondering about that too.

MrTAToad

INKEY would indeed be the more professional way of doing it.

mentalthink

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: