Subj : FPC Oneliners.
To   : Joseph Larsen
From : mark lewis
Date : Tue Jun 07 2016 10:51 am


07 Jun 16 04:50, you wrote to me:

ml>> are you still stuck on this? i can only point back to our previous conv

JL> I don't see how it could get any simpler.

==== Begin "readkey_test.txt"  ====
= pascal_lessons (1:3634/12.73) ===============================================
Msg  : 90 of 113                           Snt Loc
From : mark lewis                          1:3634/12.73    13 Feb 16 10:45:56
To   : joseph larsen
Subj : Some code i'm having problems with.
===============================================================================

13 Feb 16 00:50, you wrote to All:

jl> Here's some code. The problem is that I have to press the down arrow
jl> key twice before it executes the "bot_bar" procedure. If anyone could
jl> help, or take a look at it, i'd appreciate it.

some parts are missing for others to really be able to compile and test it...
what you should do is to simplify it into a standalone program and then work it
out using general items to replace things like the ans files and thisuser.name
and such... the following seems to work fine for me after attempting to trace
your logic flow...

==== Begin "readkey_test.pas"  ====
Program readkey_test;

Uses crt;

Var
 ch1 : char;
 ch2 : char;

Procedure show;
Begin
 writeln('      in show');
End;

Procedure bot_bar;
Begin
 writeln('    in bot_bar - display show? enter=no');
 ch2:=readkey;
 if ch2=#13 then begin
   writeln('    readkey=enter - exiting bot_bar');
   exit;
 end;
 show;
End;

Procedure top_bar;
Begin
 writeln('    in top_bar');
End;


Begin
 writeln('press uparr, dnarr or enter');
 Repeat
   writeln('in repeat block waiting on readkey');
   ch1:=ReadKey;
   case ch1 of
     #0 : begin
            writeln('readkey=nul - reading next key');
            ch1:=ReadKey;
            case ch1 of
              #72 : begin
                      writeln('  readkey=uparr');
                      top_bar;
                    end;
              #80 : begin
                      writeln('  readkey=dnarr');
                      bot_bar;
                    end;
            end; //case readkey
          end; //begin #0
   end; //case readkey
 until ch1=#13;
 writeln('readkey=enter - exiting program');
end.
==== End "readkey_test.pas" ====

remember to keep it simple and straightforward...

)\/(ark

Always Mount a Scratch Monkey

... If it's any good at all they will soon discontinue it.
-!-
! Origin:  (1:3634/12.73)

==== End "readkey_test.txt" ====

)\/(ark

Always Mount a Scratch Monkey

... Rock is Dead.  Long live Paper and Scissors!
---
* Origin:  (1:3634/12.73)