Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-10

Error Trapping w/ ReadKey

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darren Reynolds

Just getting into the "planning" phase of a personal project I'm working on, and one of the things I'm trying to do is predict where there's going to need to be some error trapping things in place. As a part of this I've been browsing various message boards taking a look at what various people have to say about the topic.

One of the things that's come up for checking user input is to monitor what they input via keystroke one char at a time using ReadKey. If I'm understanding this correctly, you can then use the case structure to tell the program what to do when specific keys are pressed.

Just wondering if I'm headed in the right direction with this, or if anyone has any code examples of ReadKey / case being used to trap per-keystroke user input

Reply by email

Marco van de Voort
to Darren Reynolds

[ Charset ISO-8859-1 unsupported, converting... ]

Show quoted text 14 lines
Just getting into the "planning" phase of a personal project I'm working on, and one of the things I'm trying to do is predict where there's going to need to be some error trapping things in place. As a part of this I've been browsing various message boards taking a look at what various people have to say about the topic. One of the things that's come up for checking user input is to monitor what they input via keystroke one char at a time using ReadKey. If I'm understanding this correctly, you can then use the case structure to tell the program what to do when specific keys are pressed. Just wondering if I'm headed in the right direction with this, or if anyone has any code examples of ReadKey / case being used to trap per-keystroke user input

Yes, see the "gameunit" unit of the demo games.

Reply by email