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.

Newcomers DBPro Corner / text_input()

Author
Message
someone namedlink
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: Dream Planet
Posted: 14th Aug 2004 23:25 Edited at: 14th Aug 2004 23:26
I made an input function and it works, but there something strange about it. When you try to delete characters, he only delete one character and then you must type some text in order to do it again. Can someone find the problem please? Because I don't see it.



DIV/DBP-coder
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 15th Aug 2004 06:13
For myself, I'd use the inkey$() function instead of entry$() for this operation, because you could get rid of that 'clear entry buffer' stuff in that event. This also means you'd have to detect the backspace as a DEL code or control-h (ascii 8 or 127) but I think it would be easier.

Now, as for the problem you mentioned, it might be that within the backspace operation you have not cleared the entry buffer, thus the backspace code is being added to your user input string before it is cleared. Try putting a clear entry buffer before the endif in the backspace code, thus that a null entry will result when you read the buffer.

If that itself does not work, then nulls are being added to the input string, so you need to check for valid characters in the buffer before adding to the input string.
S.

Any truly great code should be indisguishable from magic.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 15th Aug 2004 07:54 Edited at: 15th Aug 2004 07:56
this is courtesy of TeamTOPIA
(from DarkLINK, the dbp input version)




DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 15th Aug 2004 08:22
The problem is that entry$() will return the backspace character. So when you press backspace the first time it removes the last character and adds a backspace character. then when you press backspace again it deletes the backspace character and adds another. You don't see it happen as the test command ignores backspace characters.

Here is a snippit that gets arround the problem by removing all the backspace characters from the string when the backspace key is pressed then removes the last character.



PII 300 : 64mb ram : voodoo II 12mb : Win98
someone namedlink
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: Dream Planet
Posted: 15th Aug 2004 17:17 Edited at: 15th Aug 2004 17:18
I solved the problem, but I wrewrote the function and it is much better now. It lets you write text on different lines now. Here is it so everyone can benefit from it:



DIV/DBP-coder

Login to post a reply

Server time is: 2024-11-27 06:42:36
Your offset time is: 2024-11-27 06:42:36