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 / dbentry$(1) problem in C++ express

Author
Message
old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 19th Mar 2008 18:08
I want to use dbEntry$(1) to capture key strokes but it does not work in C++ express.

I can get dbEntry() to work but that does not manage the backspace, Anyone any idea why it does not work, or a simple work around please?

uff
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 19th Mar 2008 23:33 Edited at: 20th Mar 2008 06:15
In DBPro, that is a bit of string magic going on to pass the extra parameter...its not a variable length parameter list like it would be in C/C++.

The function you want to use is actually named GetEntryEx in DBPro, so try dbEntryEx in GDK.

EDIT: my bad, it pays to read the include files. The function is just dbGetEntry(). That's the one you want.
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 20th Mar 2008 06:16
bump <my bad>
old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 20th Mar 2008 15:12
I have now tried dbGetEntry() but it is the same as dbEntry() except it allows a prompt for answer.

dbEntry() is fine for me except that it does not cope with back space.

In dbpro I could simply look at the individual key strokes and add the key stroke to a string but I do not know how to add a character to an existing string, (nor remove the right most character).

I suppose the fundamental question is why does dbEntry$(1) not work when it is in the gdk help list??

uff
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 20th Mar 2008 16:20
strcat will append, and snprintf or sprintf can be used to get rid of a key. Those functions are very useful. Backspace is ASCII 8, and all non alphanumeric/punctuation characters are < 32 and > 126.

Here is a handy chart to help:
.http://en.wikipedia.org/wiki/ASCII

I'm not sure an old man needs an ASCII chart, but it helps. If it doesn't, sorry.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Mar 2008 19:14
Quote: "I'm not sure an old man needs an ASCII chart, but it helps. If it doesn't, sorry."
- LOL

I personally would write my own input handler and that way - I know its more work - but you have more control and know what's going on intimately and can resolve issues faster and expand on it to your heart's content!

old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 27th Mar 2008 22:36
Thanks for all the help and advice.

I have created a temporary work around but I am disapointed.

Surely the publishers should either tell us how to use a function or remove it from the list of functions on the help file.

How many more do not work?

Is there another way of asking the game creators.com theis fundamental question? What is the function of a moderator?

uff
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Mar 2008 22:45
@Old Man - the whole String thing - I have a C++ lib and if you JUST GRAB jfc_string.h and jfc_string.cpp you can get right to the string concatentation fairly easily.



http://code.google.com/p/darkgdkoop/

The PROPER thing is to learn the stdlib string classes and functions - BUT - you can use mine and get on with your game.

P.S. You don't need my WHOLE LIBRARY ... download it and take what you like and leave the rest! I knows its rather big but the string class is pretty small - and most of all easy to use.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 31st Mar 2008 20:20 Edited at: 31st Mar 2008 20:33
Here is what I use for taking input without causing the program to wait for the return key to be pressed before continuing:


-Set iAction to 1 when you want to simply return currently entered text and accept backspaces.
-Set iAction to 2 when you want to delete everything currently stored.
-Set bSpaceRemove to true if you want spaces to be removed from input.
-Returned is currently entered text.

Hope this Helps!

Login to post a reply

Server time is: 2024-09-29 17:31:10
Your offset time is: 2024-09-29 17:31:10