Board index » delphi » Pascal Guru's please help....................................................................

Pascal Guru's please help....................................................................

I just switched over from turbo pascal 3.0 to turbo pascal 7.0
Please ... someone tell me the eqivalent of "KBD" in tp7.
This is how I use to use it...

var
     ch:char;
.
.
.

Repeat
     read(kbd,ch);
     case ch of
               1:begin
                          .
                          .
                          .
                   end;

              2:begin
                          .
                     .
                          .
                  end;
       end;
       until ch='3';

Now I need to know how to do that in pascal 7.0!
SOMEONE PLEASE HELP ME!!!!!!!!!

_-BILL-_
jbill...@intersurf.com
----------------------------------

 

Re:Pascal Guru's please help....................................................................


Quote
BILL wrote:

> I just switched over from turbo pascal 3.0 to turbo pascal 7.0
> Please ... someone tell me the eqivalent of "KBD" in tp7.
> This is how I use to use it...

   You'll really like  TP 7 trust me, its a BIG Step up from 3.0
Okay now to to read a key press and store which key was read use
    readkey

Quote
> var
>      ch:char;
> .
> .
> .

> Repeat
>      read(kbd,ch);

   Instead of this   put this
      ch:=readkey;      Readkey is a FUNCTION
 for more info  type  readkey in your code and hit cntrl+F1  it will
  show you more info.
  also if you dont' care what key is being pressed you just want to
hold output on screen you can do  
    a keypressed.    
  If you had a loop like a repeat and you wanted it to repeatover and
over  , <aka  screensaver>
just

   repeat
       whatever stuff u want
   until keypressed;      

   zm...@access.east-tenn-st.edu

Re:Pascal Guru's please help....................................................................


Quote
Fletch wrote:
>   also if you dont' care what key is being pressed you just want to
> hold output on screen you can do
>     a keypressed.
>   If you had a loop like a repeat and you wanted it to repeatover and
> over  , <aka  screensaver>
> just

>    repeat
>        whatever stuff u want
>    until keypressed;

This is very bad advice, and worse, comes from the BP manual... :-)
The keypress (or two, for extended 101 keyboard keys!) will still be
in the buffer afterwards, and will be read in by the next ReadKey or
DOS/BIOS input operation.  At the very least, include an "empty
keybuffer" loop afterwards:  "while KeyPressed do ReadKey".

- Alf

Re:Pascal Guru's please help....................................................................


Quote
jbill...@intersurf.com (BILL) wrote:
>I just switched over from turbo pascal 3.0 to turbo pascal 7.0
>Please ... someone tell me the eqivalent of "KBD" in tp7.
>This is how I use to use it...
>var
>     ch:char;
>.
>.
>.
>Repeat
>     read(kbd,ch);
>     case ch of
>               1:begin
>                          .
>                          .
>                          .
>                   end;

>              2:begin
>                          .
>                 .
>                          .
>                  end;
>       end;
>       until ch='3';
>Now I need to know how to do that in pascal 7.0!
>SOMEONE PLEASE HELP ME!!!!!!!!!
>_-BILL-_
>jbill...@intersurf.com
>----------------------------------

Instead of having read(kbd,ch)  change it to the following :

ch := Readkey;

This should do the tirck.  The rest of  your program stays the same.

Who are you?  Whrere are you from?  Why the PAscal interest?

Keep well

J.C. Nortje  (j...@pixie.co.za)

Re:Pascal Guru's please help....................................................................


Quote
In article <4nomlb$...@dim.intersurf.net>, BILL <jbill...@intersurf.com> wrote:
>I just switched over from turbo pascal 3.0 to turbo pascal 7.0
>Please ... someone tell me the eqivalent of "KBD" in tp7.
>This is how I use to use it...

uses crt;

Quote
>var
>     ch:char;
>.
>.
>.

>Repeat
>     read(kbd,ch);

ch:=readkey;

Quote
>     case ch of
>               1:begin
>                          .
>                          .
>                          .
>                   end;

>              2:begin
>                          .
>                 .
>                          .
>                  end;
>       end;
>       until ch='3';

Alternatively just put "uses Turbo3;" at the beginning, but it is better to
fix the programs properly.

There is a difference in the way function (etc.) keys are reported.
Dos 4.0+ give first a null and then the scancode. Turbo3 gave an ESC
which caused problems when one needed to separate it from the esc key.

Quote
>Now I need to know how to do that in pascal 7.0!
>SOMEONE PLEASE HELP ME!!!!!!!!!

>_-BILL-_
>jbill...@intersurf.com
>----------------------------------

Osmo

Re:Pascal Guru's please help....................................................................


In article <31A04439.3...@online.no>, Alf P. Steinbach <al...@online.no> wrote:

Quote
>Fletch wrote:
>>   also if you dont' care what key is being pressed you just want to
>> hold output on screen you can do
>>     a keypressed.
>>   If you had a loop like a repeat and you wanted it to repeatover and
>> over  , <aka  screensaver>
>> just

>>    repeat
>>        whatever stuff u want
>>    until keypressed;

>This is very bad advice, and worse, comes from the BP manual... :-)
>The keypress (or two, for extended 101 keyboard keys!

Don't the standard keyboards have function and cursor keys?

) will still be

Quote
>in the buffer afterwards, and will be read in by the next ReadKey or
>DOS/BIOS input operation.  At the very least, include an "empty
>keybuffer" loop afterwards:  "while KeyPressed do ReadKey".

>- Alf

Osmo

Re:Pascal Guru's please help....................................................................


Quote
Osmo Ronkanen wrote:
> >The keypress (or two, for extended 101 keyboard keys!)

> Don't the standard keyboards have function and cursor keys?

Well, yes, them too!  Usenet does not seem to encourage me to
be very precise... :-)  At least not when answering on-line.

- Alf

Quote

> >will still be
> >in the buffer afterwards, and will be read in by the next ReadKey or
> >DOS/BIOS input operation.  At the very least, include an "empty
> >keybuffer" loop afterwards:  "while KeyPressed do ReadKey".

> >- Alf

> Osmo

Re:Pascal Guru's please help....................................................................


In article <31A2AA6C.3...@online.no>, Alf P. Steinbach <al...@online.no> wrote:

Quote
>Osmo Ronkanen wrote:
>> >The keypress (or two, for extended 101 keyboard keys!)

>> Don't the standard keyboards have function and cursor keys?

>Well, yes, them too!  Usenet does not seem to encourage me to
>be very precise... :-)  At least not when answering on-line.

Can you imagine a computer without cursor keys? A fruit company actually
once produced such a thing.

Osmo

Re:Pascal Guru's please help....................................................................


Quote
BILL wrote:

> I just switched over from turbo pascal 3.0 to turbo pascal 7.0
> Please ... someone tell me the eqivalent of "KBD" in tp7.
> This is how I use to use it...

> var
>      ch:char;

> Repeat
>      read(kbd,ch);
>      case ch of
>                1:begin
>                           .
>                           .
>        until ch='3';

> Now I need to know how to do that in pascal 7.0!
> SOMEONE PLEASE HELP ME!!!!!!!!!

  Use the readkey function

      ch:=readkey;

  This waits until you press a key. If you don't want to wait then use

       if keypressed then ch:=readkey
       else ch:=default;  { some default character. }

hope this helps,

Brian

Other Threads