Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Filling the Entry Buffer

Author
Message
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2012 15:37
Hello!

So, if I'm using ENTRY$(1) to get typed input from someone, what if I wanted to actually automatically fill that up myself?

For example... If I'm getting them to type in their character's name in a game, but I also have a "generate name" button... How would that go? Any ideas? ENTRY$(1) = "STRING" doesn't work.


Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Nov 2012 15:53
how about:
a$ = "Hello World"
do
cls
e$ = entry$(0)
empty entry buffer
if chr$(14) = e$ //backspace check.. (if im not wrong, backspace is 14, if not, fix this one..)
a$ = left$(a$,len(a$)-1)
e$ = ""
endif
a$ = a$+e$

print a$
loop

Advanced Updater for your games!
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2012 16:24
That might work! What's the difference between ENTRY$(1) and ENTRY$(0)?


Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 21st Nov 2012 16:36
ENTRY$(1) will automatically handle backspaces for you.


Previously TEH_CODERER.
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Nov 2012 16:38 Edited at: 21st Nov 2012 16:43
Quote: "ENTRY$(1) will automatically handle backspaces for you."

yup. while entry$(0) defining anykey you press as a char (including ENTER, Backspaces and so on)
so you will have to get rid of ENTER character too.

Edit:
i just got home and i fixed a thing or two on the code i posted above..
its not empty, its "clear entry buffer" and backspace is 8 instead of 14..

so the code is:



Advanced Updater for your games!
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 22nd Nov 2012 11:23
Excellent. This should do wonderfully thanks, guys!


Login to post a reply

Server time is: 2026-07-08 03:02:15
Your offset time is: 2026-07-08 03:02:15