Board index » delphi » Good old fashioned console app - want CRT unit GOTOXY equivalent

Good old fashioned console app - want CRT unit GOTOXY equivalent

Hello all Delphi wizards:

Is there a Console application CRT Unit equivalent (Like from the old
Turbo Pascal days) where I could:
  1) Clear the screen (CLRSCR)
  2) go to a row and column position on the CRT and display info.    
(GOTOXY)

Assuming there is not a replacement for CRT Unit, what is the closest
component based solution; i.e. how would I do direct positioning into
a memo component?

Thanks

David Laub

 

Re:Good old fashioned console app - want CRT unit GOTOXY equivalent


Quote
David Laub wrote:

> Hello all Delphi wizards:

> Is there a Console application CRT Unit equivalent (Like from the old
> Turbo Pascal days) where I could:
>   1) Clear the screen (CLRSCR)
>   2) go to a row and column position on the CRT and display info.
> (GOTOXY)

> Assuming there is not a replacement for CRT Unit, what is the closest
> component based solution; i.e. how would I do direct positioning into
> a memo component?

> Thanks

> David Laub

Hello,
You should check the {$AppType CONSOLE} compiler directive. I didn't see
it has the old GoToXY directive, but it is opening a window like a DOS
window.
A GoToXY is not needed to be a component It has to be a simple
procedure.

Dov Landau
Jerusalem

Re:Good old fashioned console app - want CRT unit GOTOXY equivalent


Quote
>You should check the {$AppType CONSOLE} compiler directive. I didn't see
>it has the old GoToXY directive, but it is opening a window like a DOS
>window.
>A GoToXY is not needed to be a component It has to be a simple
>procedure.

Assuming you're using Delphi 2.0, search Help for "AllocConsole", then click
"Group" up near the top of the window. This will take you to the help
for the Console API, which has all the Win32 Console functions. You can do
things like GoToXY with the functions listed there (they're not as easy, but
you could easily write some wrapper functions to do the same thing as GoToXY).

              _   __   -----------------------------------------------
  .,,        ( `-'  \  | Tyler Dauwalder                             |
 C:::]|||||||||() | |  | dauwa...@televar.com                        |
  `'`        (_.-.__/  | http://www.televar.com/~dauwaldt/index.html |
                       -----------------------------------------------

Re:Good old fashioned console app - want CRT unit GOTOXY equivalent


Quote
David Laub <udl...@uxa.ecn.bgu.edu> wrote:
>Hello all Delphi wizards:
>Is there a Console application CRT Unit equivalent (Like from the old
>Turbo Pascal days) where I could:
>  1) Clear the screen (CLRSCR)

FillConsoleOutputCharacter/FillConsoleOutputAttribute

Quote
>  2) go to a row and column position on the CRT and display info.    
>(GOTOXY)

SetConsoleCursorPosition

Quote
>Assuming there is not a replacement for CRT Unit, what is the closest
>component based solution; i.e. how would I do direct positioning into
>a memo component?

A memo if quite close (provided that you set the font to a
proportional font) - but I'd suggest writing your own custom console
window - much like in Windows terminal programs.

Regards,

Jani J?rvinen
a.k.a SilverStream Software
Helsinki Finland

Tools, information, tips, reviews & bug lists
for professional Delphi, Win32 and WinHelp developers.

mailto:ja...@dystopia.fi
http://www.dystopia.fi/~janij/

Other Threads