Source Code For Using Function Keys or Cursor Keys - H 
Author Message
 Source Code For Using Function Keys or Cursor Keys - H


Quote:

>>     I doing some school project on writing program in Pascal
>>(DOS/Version 7).   I have plans to make the menu selection by using
>>the cursor key (Left,Right,Up,Down) & some Function Keys.  Could
>>anyone assist me?  Could you send me the ansi equivalent of that key?
>>  Next, after making a window in pascal using the command
>>'window(X1,Y1,X2,Y2)' ....how do i make the cursor move outside that
>>window?...do i have to use the 'gotoxy' command? or is there a way of
>>closing that window?   Thx in advance.  Greatly appreciated. :)

>        Below I have enclosed a program written in Turbo Pascal which
[...]
>writeln('In Function Keys Program');
>   repeat
>       ch := readkey;
>       if ord(ch) = 0
>       then ch := readkey;

>       case ord(ch) of

>            59 : writeln('Function key 1');
>            60 : writeln('Function key 2');

[...]

Better:
------------------
  repeat
    i := Ord( ReadKey );
    if i = 0 then i := 1000 + ReadKey;
    case i of
      1059: writeLn( 'F1' );
      { etc }
-------------------

Why?
Example: Key 'A' = #$41 = #65, and your program response: 'Function key 7'

------------------------
Program TestKeyboardCodes;

var c: char; i: integer;

begin
  while KeyPressed do c := ReadKey; {clear buffer}
  repeat
    c := ReadKey;
    case c of
           #0: begin
                 c := ReadKey;
                 WriteLn( '0+', Ord( c ) )
               end

         else: WriteLn( c, ':', Ord( c ) )
    end
  until c = ^[ {ESC}
end.

--

/------------------------------------------------------------------




Sun, 15 Nov 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Source Code For Using Function Keys or Cursor Keys - Help :)

2. Using the Function Keys and The Escape Key

3. Reading function/cursor keys

4. using enter key instead of tab key for data entry

5. Source Code for a Key Capture Program

6. Using function keys

7. Removing a Key using code?

8. read cursor keys

9. read cursor key

10. How to put cursor-keys in keyboard buffer??

11. !!!! Enter Key -> Tab Key

12. !!! Help, Cursor Keys

 

 
Powered by phpBB® Forum Software