Subj : FPC Oneliners.
To : Joseph Larsen
From : mark lewis
Date : Thu Jun 09 2016 12:20 pm
09 Jun 16 01:56, you wrote to me:
ml>> remember to keep it simple and straightforward...
JL> I think I know the problem.
[trim]
JL> See the "#8 : begin" ? I don't think that's right. Any idea what I
JL> change it to?
that's a zero, not an eight... that zero is the null character and must be used
to detect double-character keycodes like the F-keys and the arrow keys...
change your routine to a completely stand alone program so you can test it
easier... watch your formatting, too... below is such a standalone with an
added key displaying routine so you can see which key has been pressed... you
can remove that one entire routine and the two calls to it and the program
should operate like what you already have that you are having troubles with...
WARNING: some keys may not return the expected codes (eg: the END key) and
others may be taken over by your terminal (eg: ALT-F?? keys)...
===== snip test_position.pas =====
program test_position;
Begin
writeln('>> do show routine <<');
writeln('press any key to continue or ENTER to quit.');
Repeat
ch1 := #00;
ch2 := #00;
if keypressed then
begin
writeln('>> display onen.ans here <<');
ch1 := readkey;
case ch1 of
#00 : begin
if keypressed then
begin
ch2 := readkey;
displaykey(ch1,ch2);
case ch2 of
#80 : writeln('>> do bot_bar routine <<');
#72 : writeln('>> do top_bar routine <<');
end; {case ch2}
end; {if keypressed}
end; {begin ch1 = #00}
else
displaykey(ch1,ch2);
end; {case ch1}
end; {if keypressed}
until ch1=#13;
end.
===== snip =====
)\/(ark
Always Mount a Scratch Monkey
... 48. Sympathy is a crutch, never fake a limp.
---
* Origin: (1:3634/12.73)