Author Topic: How I can count the characters of Input command  (Read 2220 times)

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3372
  • Integrated Brain
    • View Profile
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

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

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3372
  • Integrated Brain
    • View Profile
Thanks mrT

Offline msx

  • Prof. Inline
  • *****
  • Posts: 773
    • View Profile
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

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4349
    • View Profile
    • FUED
Nice, I was wondering about that too.

MrTAToad

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

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3372
  • Integrated Brain
    • View Profile
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: