comp.lang.ada
 help / color / mirror / Atom feed
From: "Heath Isler" <isler@gfherald.infi.net>
Subject: Re: Terminal IO, and menus
Date: 1999/04/01
Date: 1999-04-01T00:00:00+00:00	[thread overview]
Message-ID: <7dv2pm$mq5$1@nw003t.infi.net> (raw)
In-Reply-To: m3677if8ks.fsf@mheaney.ni.net

Hello,

I would like to thank everyone  for the input.  I have decided to use the
escape sequences for a ansi terminal since my target platforms are Win9X,
Dos, Unixes, I don't care at this point if it runs on Win NT since I don't
have it.

Heath

Matthew Heaney <matthew_heaney@acm.org> wrote in message
news:m3677if8ks.fsf@mheaney.ni.net...
> "Heath Isler" <isler@gfherald.infi.net> writes:
>
> > My question is is there a way in the stadard packages to Clear the
Screen
> > and postition the cursor in a specific location, i.e. Locate_Cursor (x
=>
> > 10, y =>15); ?  I am plan on using this for menus and data input.
>
> No, there's nothing in the Ada predefined packages to do that.
>
>
> > I have also looked through a lot of packages on the net, and some of
> > them seem to fit my need.  I not sure if I should use one of the
> > Terminal IO or menu packages.  Can anyone recommend a package to use?
>
> In the GNAT source distribution, the dining philosophers example does
> terminal I/O using escape sequences.
>
>
> --::::::::::
> --screen.ads
> --::::::::::
> package Screen is
>
>   -- simple ANSI terminal emulator
>   -- Michael Feldman, The George Washington University
>   -- July, 1995
>
>   ScreenHeight : constant Integer := 24;
>   ScreenWidth : constant Integer := 80;
>
>   subtype Height is Integer range 1..ScreenHeight;
>   subtype Width  is Integer range 1..ScreenWidth;
>
>   type Position is record
>     Row   : Height := 1;
>     Column: Width := 1;
>   end record;
>
>   procedure Beep;
>   -- Pre:  none
>   -- Post: the terminal beeps once
>
>   procedure ClearScreen;
>   -- Pre:  none
>   -- Post: the terminal screen is cleared
>
>   procedure MoveCursor (To: in Position);
>   -- Pre:  To is defined
>   -- Post: the terminal cursor is moved to the given position
>
> end Screen;
>
>
> --::::::::::
> --screen.adb
> --::::::::::
> with Text_IO;
> package body Screen is
>
>   -- simple ANSI terminal emulator
>   -- Michael Feldman, The George Washington University
>   -- July, 1995
>
>   -- These procedures will work correctly only if the actual
>   -- terminal is ANSI compatible. ANSI.SYS on a DOS machine
>   -- will suffice.
>
>   package Int_IO is new Text_IO.Integer_IO (Num => Integer);
>
>   procedure Beep is
>   begin
>     Text_IO.Put (Item => ASCII.BEL);
>   end Beep;
>
>   procedure ClearScreen is
>   begin
>     Text_IO.Put (Item => ASCII.ESC);
>     Text_IO.Put (Item => "[2J");
>   end ClearScreen;
>
>   procedure MoveCursor (To: in Position) is
>   begin
>     Text_IO.New_Line;
>     Text_IO.Put (Item => ASCII.ESC);
>     Text_IO.Put ("[");
>     Int_IO.Put (Item => To.Row, Width => 1);
>     Text_IO.Put (Item => ';');
>     Int_IO.Put (Item => To.Column, Width => 1);
>     Text_IO.Put (Item => 'f');
>   end MoveCursor;
>
> end Screen;






  reply	other threads:[~1999-04-01  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-30  0:00 Terminal IO, and menus Heath Isler
1999-03-30  0:00 ` David C. Hoos, Sr.
1999-03-31  0:00 ` Matthew Heaney
1999-04-01  0:00   ` Heath Isler [this message]
1999-04-01  0:00     ` John J Cupak Jr
1999-04-01  0:00   ` Bill Eriksson
1999-03-31  0:00 ` Jerry van Dijk
1999-03-31  0:00   ` Tarjei Tj�stheim Jensen
1999-04-02  0:00     ` Jerry van Dijk
1999-04-01  0:00   ` Juergen Pfeifer
1999-04-02  0:00     ` Jerry van Dijk
1999-04-02  0:00       ` dennison
1999-04-03  0:00         ` Jerry van Dijk
1999-04-04  0:00           ` Tarjei Tj�stheim Jensen
1999-04-04  0:00       ` Juergen Pfeifer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox