Board index » delphi » getting rid of Readln;

getting rid of Readln;

In the graphics mode, when I ask for a readln, and the user types, the text
is displayed at the top right of the screen, Is there a way of being able
to place it somewhere else? It would be okay if it always stayed there, but
every readln, moves it down a line.

        The other problem I'm having is with record files, is there a way
of deleting a record in the middle and moving the rest up?

Oh ya, Thanx for all your help with the exec command, I'm still not really
sure about the command line, but I've figured out that to get an exe file
going you need dir *.exe in it.

|\  |                                                        ---\
| \ |                                               //-__cd_/ /\(
|  \|eil Cutler                                     ))( )___)__
                                                    ||//    | /
email:ncut...@duncan.island.net                       |\    |
IRC Handle: LienKlaw                             equestrian fan & rider
Enigma fan & Mac techno geek himself!          Mia,"Oh no, Xmas is over and
http://www.island.net/~ncutler/                    "he's putting that thing
                                                   "in my mouth again"
"NO! not back to school again!"

"Do Not Attempt to Traverse a Chasm in Two Leaps."

 

Re:getting rid of Readln;


At 06:09 PM 1/14/96 PST, Neil Cutler <ncut...@island.net> wrote:

Quote
>In the graphics mode, when I ask for a readln, and the user types, the text
>is displayed at the top right of the screen, Is there a way of being able
>to place it somewhere else? It would be okay if it always stayed there, but
>every readln, moves it down a line.

>        The other problem I'm having is with record files, is there a way
>of deleting a record in the middle and moving the rest up?

>Oh ya, Thanx for all your help with the exec command, I'm still not really
>sure about the command line, but I've figured out that to get an exe file
>going you need dir *.exe in it.

here is some stuff:
{ *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*=
 }
Const
     Extended            =3D0;
     Ascii_7             =3D1;
     Numbers             =3D2;
     Req                 =3D128;

Type
    T_Auto               =3DRecord
                                YN:Boolean;
                                MOff:Boolean;
                                E:Boolean;
                                P:Byte;
                                L:Byte;
                                S:String;
                          End;

{ *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*=
 }

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure PutChar(C:Char;Count:Byte); Assembler;
Asm
   mov ah,09
   mov al,byte ptr [c]
   xor bh,bh
   mov bl, byte ptr [Textattr]
   xor cx,cx
   mov cl, Byte ptr [count]
   int 10h
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }
{
Procedure Out(S:String);
Begin
     Write(s);
End;

Quote
}

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure GetCurPos(Var CPos:T_CPos);

Begin
     CPos.X:=3DWhereX;
     CPos.Y:=3DWhereY;
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure SetCurPos(CPos:T_CPos);

Begin
     GotoXY(CPos.X,CPos.Y);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure KBD_IO (Var=
 S:String;L:Byte;Valid:Byte;Echo_YN:Boolean;Echo_Chr:Char);

Var
   C                     :Char;
   Done                  :Boolean;
   CmpSet                :Set of Char;
   p                     :Byte;
   MandEntry             :Boolean;
   Auto                  :T_Auto;

 Function GetChar:Char;
 Begin
      If Not Auto.YN Then
       Begin
            GetChar:=3DReadKey;
       End
      Else
       Begin
            GetChar:=3DAuto.S[Auto.P];
            inc(Auto.P);
            If Auto.P=3DAuto.L Then
             Begin
                  Auto.MOff:=3DYes;
             End;
       End;
 End;
 Procedure BackSpace;
 Begin
      dec(p);
      s[0]:=3Dchr(p);
      if Echo_YN or not (Echo_Chr=3D#0) then
       Begin
            write(#8,' ',#8);
       End;
 End;

 Procedure KillLine;
 Begin
      While p> 0 do
       Begin
            BackSpace;
       End;
 End;

Begin
     Case Valid of

      Extended
          :Begin
                CmpSet:=3D[#32..#255];
                MandEntry:=3DNo;
           End;

      Ascii_7
          :Begin
                CmpSet:=3D[#32..#127];
                MandEntry:=3DNo;
           End;
      Numbers
          :Begin
                CmpSet:=3D['0'..'9'];
                MandEntry:=3DNo;
           End;
      Extended + Req
          :Begin
                CmpSet:=3D[#32..#255];
                MandEntry:=3DYes;
           End;
      Ascii_7 + Req
          :Begin
                CmpSet:=3D[#32..#127];
                MandEntry:=3DYes;
           End;
      Numbers + Req
          :Begin
                CmpSet:=3D['0'..'9'];
                MandEntry:=3DYes;
           End;
      else
           Begin
                CmpSet:=3D[#0..#255];
           End;
     End;
     if s[0]>#0 then
      Begin
           Auto.YN:=3DOn;
           Auto.E:=3DYes;
           Auto.S:=3DS;
           Auto.P:=3D1;
           Auto.L:=3DLength(Auto.S)+1;
           Auto.MOff:=3DNo;
      End
     else
      Begin
           Auto.YN:=3DOff;
           Auto.E:=3DNo;
      End;
     s:=3D'';
     p:=3D0;
     Done:=3Dno;
     While not done do
      Begin
           c:=3DGetChar;
           if c<#32 Then
            Begin
                 Case c of
                  #000:Begin
                            C:=3DGetChar;
                            {

                            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                            Provide Extended Key support here!!!!!

                            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                            }
                       End;
                  #013:Begin
                            if (Not MandEntry) or (s[0]>#0) then Done:=3DYes=
;
                       End;
                  #027:Begin
                            S:=3D#27;
                            Done:=3DYes;
                       End;
                  #008:Begin
                            if p> 0 then
                             Begin
                                  BackSpace;
                                  Auto.E:=3DOff;
                             End;
                       End;
                 End;
            End
           Else
            Begin
                 if (c in CmpSet) Then
                  Begin
                       If Auto.E and not Auto.YN Then
                        Begin
                             KillLine;
                             Auto.E:=3DNo;
                        End;
                       If Auto.MOff Then
                        Begin
                             Auto.MOff:=3DNo;
                             Auto.YN:=3DNo;
                        End;

                       IF (p<L) then
                        Begin
                             inc (p);
                             s[0]:=3Dchr(p);
                             s[p]:=3Dc;
                             If Echo_YN Then
                              Begin
                                   write(c);
                              End
                             Else
                              Begin
                                   If not(Echo_Chr=3D#0) Then
                                    Begin
                                         Write(Echo_Chr);
                                    End;
                              End;
                        End
                       Else
                        Begin
                             ErrBeep;
                        End;
                  End
                 Else
                  Begin
                       ErrBeep;
                  End;

            End;
      End;
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure ReadKBD (Var S:String;L:Byte;Valid:Byte);

Begin
     KBD_IO(S,L,Valid,Yes,#0);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure Line_V(x,y,len:Byte;c:Char);

Var
   Cur                   :T_CPos;

Begin
     GetCurPos(Cur);

     len:=3Dy+len-1;

     For y:=3Dy to len do
      Begin
           gotoXY(x,y);
           PutChar(c,1);
      End;

     SetCurPos(Cur);

End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure Line_H(x,y,len:Byte;c:Char);

Var
   Cur                   :T_CPos;

Begin
     GetCurPos(Cur);

     len:=3DX+len-1;

     For x:=3Dx to len do
      Begin
           gotoXY(x,y);
           PutChar(c,1);
      End;

     SetCurPos(Cur);

End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }
Procedure Box(x1,y1,x2,y2:Byte;LR,TB,UL,DL,DR,UR:Char);

Var
   Cur                   :T_CPos;

Begin
     GetCurPos(Cur);
     Line_V(x1,y1+1,(y2-y1)-1,LR);
     Line_V(x2,y1+1,(y2-y1)-1,LR);
     Line_H(x1+1,y1,(x2-x1)-1,TB);
     Line_H(x1+1,y2,(x2-x1)-1,TB);
     gotoxy(x1,y1);
     PutChar(UL,1);
     gotoxy(x1,y2);
     PutChar(DL,1);
     gotoxy(x2,y1);
     PutChar(UR,1);
     gotoxy(x2,y2);
     PutChar(DR,1);
     SetCurPos(Cur);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure CenterPrompt(x1,x2,y,ofst:Byte;S:String);

Var
   Cur                   :T_CPos;

Begin
     GotoXY( (((x1+x2) div 2)-( (Length(s)+ofst) div 2))+1, Y);
     Write(S);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure Center(x1,x2,y:Byte;S:String);

Var
   Cur                   :T_CPos;

Begin
     GetCurPos(Cur);

     CenterPrompt(x1,x2,y,0,S);

     SetCurPos(Cur);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure LeftPrompt(x,y,ofst:Byte;S:String);

Var
   Cur                   :T_CPos;

Begin
     GotoXY(x, Y);
     Write(S);
End;

{ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- }

Procedure Left(x,y:Byte;S:String);

Var
   Cur                   :T_CPos;

Begin
     GetCurPos(Cur);

     LeftPrompt(x,y,0,S);
...

read more »

Other Threads