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.

Dark GDK / dbClearEntryBuffer() and dbEntry() problem

Author
Message
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 14th Jan 2008 19:14
The code below has the following problem.

-After backspace has been pressed (char code of 14): if 'key' is in the entry buffer, "Key has been typed " will be printed. This is what should happen.

-After return (enter) key has been pressed but before the backspace key has been pressed "Key has been typed " is NOT printed if 'key' is in the buffer. This should not happen. "Key has been typed " should be printed regardless, if 'key' is in the buffer.

Have I made a mistake in the code below?

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 14th Jan 2008 19:39 Edited at: 14th Jan 2008 20:14
EDITed - nonsense
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 14th Jan 2008 19:40
Quote: "Your code doesn't work because dbEntry() will return the return key character as well (ASCII code 13)."


But he makes the buffer empty, isn't that wrong behavior?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 14th Jan 2008 19:53 Edited at: 14th Jan 2008 19:57


Above code now works. I discovered the problem:

The buffer was being cleared before the enter key was released, which meant that even though it was cleared, it was readded to the buffer straight away since the key was still down.
So, I've moved the buffer to being cleared after the enter key is released. Unfortunately, it is still added to the buffer because C++ is too fast for DB so I had to put dbwait(1) in aswell.
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 14th Jan 2008 20:15
Oh, sure. Stupid me

Login to post a reply

Server time is: 2024-10-08 15:48:18
Your offset time is: 2024-10-08 15:48:18