View Full Version : user text input with delphiX and DXDraw surface

07-11-2003, 08:08 PM
Hi all,,, :)

I want to get text input from the user while displaying other text on the DXDraw.surface...

Now ideally I would like to use an Edit box.. and in fact, can do so in some circumstances.... by setting the focus to the editbox with Edit1.setfocus..

But it does not work sometimes...

What is the best way to achieve my desired text input in the above situation?? without having to process individual keystrokes...

Or do I have to write a routine to process keystrokes with DXInput?

cheeeeeeeeerrrrrrrrrssssssssss ato

Harry Hunt
07-11-2003, 10:58 PM
Setting the focus to an edit component is a good idea. I've used it myself and it worked fine so you might want to find out why it doesn't work in the situations that you mentioned.
Dealing with keystrokes i no biggy either, though. All you need is a string variable which will function as your type buffer. You don't even have to use DirectInput (unless you're already using it elsewhere in your game)... you can just use the OnKeyUp event of your form. Whenever the user presses a key, append that key to your string. If you want to simulate an input box, you'll also need a "cursorposition" variable which you initially set to "1" and increment whenever the user presses a key. If the user presses the left arrow key, you decrement that variable and if he presses the right arrow key, you increment it. Also handle Backspace/Delete and you get a fully functional edit box.

08-11-2003, 07:18 PM
Hi Harry.. :)

Thx 4 reply,, yes well I am using dxinput anyway so until I find out why my editbox "dontwerk" i will just write the input routine...

cheeeeeeeerrrrrrrrrsssssssssss a

08-11-2003, 08:19 PM
Hi agin...:)


hmmm , It seemed a much neater solution to use the Edit box, so I investigated further, and got it to work by including

Application.Processmessages within the appropriate loop....

The loop was a ( repeat until ) and was not getting messages from keydown events....

cheeeeeeeerrrrrrsssssss ato