From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ff34bb99bda04ad7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-08 20:31:00 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!Starbase.NeoSoft.COM!not-for-mail From: daver@Starbase.NeoSoft.COM (Dave Retherford) Newsgroups: comp.lang.ada Subject: Re: GOTOXY in Ada ? Date: 8 Dec 1994 22:19:38 -0600 Organization: NeoSoft Internet Services +1 713 684 5969 Message-ID: <3c8lsq$rhu@Starbase.NeoSoft.COM> References: <3c4a9a$1lts@obelix.uni-muenster.de> <1994Dec8.080423.3368@sei.cmu.edu> NNTP-Posting-Host: starbase.neosoft.com Date: 1994-12-08T22:19:38-06:00 List-Id: In article <1994Dec8.080423.3368@sei.cmu.edu>, Philip Brashear wrote: > In article <3c4a9a$1lts@obelix.uni-muenster.de> ahlersj@comix.uni-muenster.de (Jan Ahlers) writes: > > > >Is there an equivalent in Ada to the gotoxy command in Pascal (-> put the > >cursor at column x, row y) ? Answers would be greatly appreciated ! > > > > Jan, let me point out that Pascal has no such command either. The particular > Pascal implementation (compiler/environment/libraries) that you are using is > kind enough to supply you with cursor movement operations. You must realize > that such things are completely dependent on the kind of display device you > are using. Since Pascal is intended to be portable, the language definition > doesn't specify such things. > > That being said, it should be obvious that Ada doesn't specify cursor control > either. However, it's simple enough to write your own, provided that you can > track down the appropriate "escape sequences" that make your terminal do what > you want. Just do text_io "put" to the screen, sending a string like > > ASCII.ESC & "[6;14H" > > If you're using an ANSI standard terminal, will send the cursor to line 6, > column 14. > > DISCLAIMER: I didn't try this precisely -- I depended on memory and an out- > of-date reference manual for a particular terminal. Nevertheless, the idea > works. I've used it several times. > > Good hunting! > > Phil Brashear > CTA INCORPORATED > > Or you could 'roll your own' version: -------- package cursor_control is procedure gotoxy(x : in positive_count, y : in positive_count); end cursor_control; with text_io; package body cursor_control is procedure gotoxy(x : in positive_count, y : in positive_count) is begin text_io.set_col(to => x); text_io.set_line(to => y); end gotoxy; end cursor_control; ---------- Of course this will only give you cursor control at a character positioning level. Also, this works with whatever the standard output file (or rather default one) which in most cases will be the screen (at least it is on the compilers I use). Hope this helps. Dave. -- _________________________________________________________________________ | Dave Retherford |"Remember this: the guy down | | Daver@Neosoft.com or: | there kissing your butt could be | | Dave_Retherford@hso.link.com [work] | just as easily biting it too." | | | -- Forestt Gump | |______________________________________|__________________________________|