On Fri, Nov 18, 2011 at 11:48 AM, William Oliveira Ferreira wrote:

i´ve always used
c := ReadKey;
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informação

to expand on that, use the boolean function keypressed. Remember on IBM compatibles that function keys send 2 scan codes. The first, #0, to indicate a function key and not a normal key, and then the scan code for the actual keypress. This includes the edit keys (insert, delete, home, end, pgup, pgdn, and arrow keys).

Here is a code fragment for an example:

if keypressed then
  begin
        c := readkey;
        if c = #0 then
            begin
                  c := readkey;
                  case c of
                         #132 : doSomething;
                            .
                            .
                            .
                  end; {case c}
            end {if #0 is true}
       else
          begin
            case c of
                   #132 : doSomethingElse;
                            .
                            .
                            .
            end; {case c}
          end; {if #0 is false}
  end; {if keypressed}

This is a Turbo Pascal convention (and FPC), not a standard or UCSD Pascal convention. Remember that strings are not a standard type, either.


2011/11/18 Henry Vermaak <[email protected]>

On 18/11/11 16:18, Chris Kirkpatrick wrote:

It really needs get(c) but this function, together with put(c), which were defined in Jensen & Wirth and all standard Pascals, has long been missing from Turbo Pascal, and all its deriviatives such as Freepascal.


How does get(c) differ from read(c)?  The problem here is with the
terminal buffering the characters until return is pressed, hence the need for re-configuring the terminal so that each key press is sent immediately.

Henry


--
______________________________**_________________
Lazarus mailing list

[email protected].**freepascal.org<[email protected]>

http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>



     ------------------------------

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to