#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Ye Olde England
    Posts
    80
    Rep Power
    12

    Question Colourful Pascal Console


    Hi,

    I know this is not about C, but there is no space for Pascal on this, the best developer's forum site.

    I am studying computing at college at the moment and we have to learn Pascal. I am already an experienced programmer and so learning an outdated language (at least thatís my opinion) such as this is annoying to say the least. I want to brighten it up a bit. We have started, as usual in console programming and so the programs arenít exactly thrilling. Therefore I would like to brighten it up a bit. Does anyone know of any graphical commands for the Pascal console? Perhaps to change the text colour or to draw a line?

    Regards

    Tajmiester
    Thanx Tajmiester.
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,172
    Rep Power
    2222
    What Pascal compiler are you using?

    The problem with Pascal is that Standard Pascal doesn't have that many features. It was created to be an academic language to be used for teaching structured programming. Console output is strictly teletype mode and file I/O is strictly sequential. Every industrial-strength compiler, including Borland's Turbo Pascal, had to extend the language with libraries that allowed us to do direct file access and fancy stuff on the console. The problem is that every compiler extended the language differently.

    The other problem is that it's been so long that I'd have to go back and look all that up again for Turbo Pascal.
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Turbo Pascal had TextColor and TextBackground IIRC. You called it like this:
    TextColor(red);
    TextBackground(white);

    or
    TextColor(4);
    TextBackground(15);
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Ye Olde England
    Posts
    80
    Rep Power
    12
    Hi,

    I am using Borland Delphi.

    Thanks
  8. #5
  9. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,172
    Rep Power
    2222
    Originally posted by tajmiester
    Hi,

    I am using Borland Delphi.

    Thanks
    Delphi isn't a "dead language", but is actively being used for development. Plus, from what I've been told, with their Kylix product you can do cross-platform Delphi and C++Builder development between Windows and Linux.

    Does Delphi support console applications? I had tried working with it shortly after its release, but found the documentation and sample programs to be worthless. All they did was show how to "program" solely by manipulating object properties, but they never showed how to attach useful code to that GUI. The only way you could figure out how to use Delphi was through third-party books. I liked the idea of being able to switch between the visual design and code (unlike VB3), but other than that it was worthless. I eagerly awaited C++Builder and was disappointed to find its documentation to be similarly abysmal. I had been a long-time fan of Borland, but that drove me away and I've never gone back. Hopefully they've at least tried to improve the situation.

    Anyway, see if Delphi's console support also supports the functions that Scorpions had mentioned. If not, then there might be something in the help files on console programming. I know that Microsoft has an entire API for it.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Ye Olde England
    Posts
    80
    Rep Power
    12
    Hi,

    I tried those methods and none of them worked. It just thought that they were undefined indentifiers!

    Also I had no idea that Pascal was still so popular, our lectuerer gave us the impretion that it is very high level language and was just to be used as a tool to teach the basics before we go on to C and C++.

    Regards

    Tajmiester
  12. #7
  13. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    You can create a console application just fine in Delphi. In Delphi 6, I did the following:
    File --> New --> Other
    Select "Console Application" and it will create a skeleton console application for you. Then you can write code as follows (bold lines added by me, everything else added by the wizard):
    Code:
    program Project1;
    
    {$APPTYPE CONSOLE}
    
    uses
    	SysUtils;
    
    begin
    	{ TODO -oUser -cConsole Main : Insert code here }
        writeln('Hello world');
        readln;
    end.
    This should compile and run just fine in a DOS window. Admittedly, it doesn't do much at all, but this is just to prove that console apps are easy to write in Delphi. As for adding colours and stuff, check this out: http://www.geocities.com/SiliconVall...6/con_apps.htm

    Please note that we have a dedicated Delphi forum here and you should perhaps post any other delphi questions in that forum. Hope this helps :D.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo