Just a sample of the Echomail archive
Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.
|    PASCAL_LESSONS    |    Pascal Programming Lessons    |    361 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 238 of 361    |
|    mark lewis to joseph larsen    |
|    Some code i'm having problems with.    |
|    13 Feb 16 10:45:56    |
   
   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 key   
    jl> twice before it executes the "bot_bar" procedure. If anyone could help, or   
    jl> 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   
   thisuer.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)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca