Subj : FPC Oneliners.
To : mark lewis
From : Joseph Larsen
Date : Wed Jun 08 2016 07:06 am
ml> ==== Begin "readkey_test.txt" ====
ml> = pascal_lessons (1:3634/12.73) =======================================
ml> Msg : 90 of 113 Snt Loc
ml> From : mark lewis 1:3634/12.73 13 Feb 16 1
ml> To : joseph larsen
ml> Subj : Some code i'm having problems with.
ml> =======================================================================
ml>
ml> 13 Feb 16 00:50, you wrote to All:
ml>
ml> jl> Here's some code. The problem is that I have to press the down arr
ml> jl> key twice before it executes the "bot_bar" procedure. If anyone co
ml> jl> help, or take a look at it, i'd appreciate it.
ml>
ml> some parts are missing for others to really be able to compile and test
ml>
ml> ==== Begin "readkey_test.pas" ====
ml> Program readkey_test;
ml>
ml> Uses crt;
ml>
ml> Var
ml> ch1 : char;
ml> ch2 : char;
ml>
ml> Procedure show;
ml> Begin
ml> writeln(' in show');
ml> End;
ml>
ml> Procedure bot_bar;
ml> Begin
ml> writeln(' in bot_bar - display show? enter=no');
ml> ch2:=readkey;
ml> if ch2=#13 then begin
ml> writeln(' readkey=enter - exiting bot_bar');
ml> exit;
ml> end;
ml> show;
ml> End;
ml>
ml> Procedure top_bar;
ml> Begin
ml> writeln(' in top_bar');
ml> End;
ml>
ml>
ml> Begin
ml> writeln('press uparr, dnarr or enter');
ml> Repeat
ml> writeln('in repeat block waiting on readkey');
ml> ch1:=ReadKey;
ml> case ch1 of
ml> #0 : begin
ml> writeln('readkey=nul - reading next key');
ml> ch1:=ReadKey;
ml> case ch1 of
ml> #72 : begin
ml> writeln(' readkey=uparr');
ml> top_bar;
ml> end;
ml> #80 : begin
ml> writeln(' readkey=dnarr');
ml> bot_bar;
ml> end;
ml> end; //case readkey
ml> end; //begin #0
ml> end; //case readkey
ml> until ch1=#13;
ml> writeln('readkey=enter - exiting program');
ml> end.
ml> ==== End "readkey_test.pas" ====
Ok. I made the changes you suggested. Same problem. It takes 2 press of the
down arrow key to get the bot_bar procedure. :/