DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Help with Delphi Console Keypress  (Read 12,956 times)

CodeTRUCKER

  • Bush Flying... where I'd rather be.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,086
    • Participated in NANY Challenge Once
    • Military Service Badge - US Navy
Help with Delphi Console Keypress
« on: December 19, 2006, 08:18 PM »
I was looking to test out an app idea with the Delphi Console Keypress (or whatever it is) and was interested in some opinions.  The reason I want to use the "console" is because it is a game for the blind.
DISCLAIMER - I have made and make many threads for questions and even project posts across the Internet. Unfortunately, many are in limbo because I cannot remember where they are at. If anyone knows of an open thread or an unanswered inquiry, please PM me. Thank you.
   
Notice: Unless stated otherwise, I receive no compensation for anything I post here.
« Last Edit: December 10, 2009, 06:53 AM by CodeTRUCKER »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Help with Delphi Console Keypress
« Reply #1 on: December 19, 2006, 08:23 PM »
dont make a console application; make a form, then you can catch all the keystrokes in a nice event.

CodeTRUCKER

  • Bush Flying... where I'd rather be.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,086
    • Participated in NANY Challenge Once
    • Military Service Badge - US Navy
Re: Help with Delphi Console Keypress
« Reply #2 on: December 19, 2006, 08:35 PM »
Alright, no console.  Anyone else want to chime in?
DISCLAIMER - I have made and make many threads for questions and even project posts across the Internet. Unfortunately, many are in limbo because I cannot remember where they are at. If anyone knows of an open thread or an unanswered inquiry, please PM me. Thank you.
   
Notice: Unless stated otherwise, I receive no compensation for anything I post here.
« Last Edit: December 10, 2009, 06:52 AM by CodeTRUCKER »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,888
    • Participated in NANY Challenge Six Times
    • Coding Snacks
    • Gathering Badge
    • Cody Award
    • Volunteers/Staff
Re: Help with Delphi Console Keypress
« Reply #3 on: December 19, 2006, 11:10 PM »
It can have a GUI.

Just be sure you close your eyes before hitting F9 in Delphi and don't open them again till you have hit alt+F4, when testing your game.

Then you will know if it is acceptable or not.  ;)

CodeTRUCKER

  • Bush Flying... where I'd rather be.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,086
    • Participated in NANY Challenge Once
    • Military Service Badge - US Navy
Re: Help with Delphi Console Keypress
« Reply #4 on: December 19, 2006, 11:31 PM »

BTW - Can you tell me why any string def I use will not allow more then 255 chars?  This even happens when I declare the following...

var
      Longstring: AnsiString;

It's supposed to take 2GB, but I keep getting the error saying it can only have 255?  Weird.
DISCLAIMER - I have made and make many threads for questions and even project posts across the Internet. Unfortunately, many are in limbo because I cannot remember where they are at. If anyone knows of an open thread or an unanswered inquiry, please PM me. Thank you.
   
Notice: Unless stated otherwise, I receive no compensation for anything I post here.
« Last Edit: December 10, 2009, 06:49 AM by CodeTRUCKER »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • Participated in NANY Challenge Twice
Re: Help with Delphi Console Keypress
« Reply #5 on: December 20, 2006, 03:33 PM »

BTW - Can you tell me why any string def I use will not allow more then 255 chars?  This even happens when I declare the following...

var
      Longstring: AnsiString;

It's supposed to take 2GB, but I keep getting the error saying it can only have 255?  Weird.

When you declare a var as AnsiString in Delphi, you get the old-style statically allocated string with max length of 255. It's the same as saying
var
myStr : string[255];


What you need is
var
myStr : string;


Also check in Compiler options that "Huge strings" is enabled - it should be on by default, but do verify. If this define is disabled, the above declaration will still give you a 255-char string.

CodeTRUCKER

  • Bush Flying... where I'd rather be.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,086
    • Participated in NANY Challenge Once
    • Military Service Badge - US Navy
Re: Help with Delphi Console Keypress
« Reply #6 on: December 21, 2006, 07:12 AM »
Thank you.  I will give it a try and get back.
DISCLAIMER - I have made and make many threads for questions and even project posts across the Internet. Unfortunately, many are in limbo because I cannot remember where they are at. If anyone knows of an open thread or an unanswered inquiry, please PM me. Thank you.
   
Notice: Unless stated otherwise, I receive no compensation for anything I post here.
« Last Edit: December 10, 2009, 06:55 AM by CodeTRUCKER »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Help with Delphi Console Keypress
« Reply #7 on: December 21, 2006, 11:08 AM »
maybe you can tell us more about the "error" you are getting, to help us help you figure out what it is.

CodeTRUCKER

  • Bush Flying... where I'd rather be.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,086
    • Participated in NANY Challenge Once
    • Military Service Badge - US Navy
Re: Help with Delphi Console Keypress
« Reply #8 on: December 21, 2006, 12:05 PM »
I can't get past the 255 error.  Like I said, weird.  Frankly at this point I may have to punt and press on with my old VB5.  I know that pretty well, but I was hoping to get my feet into Delphi.  Well, maybe later I can try again.  I can't wait too long, though.  My trial license of Turbo Delphi is only good for 98 more years! :P  Thanks to All for the help.
DISCLAIMER - I have made and make many threads for questions and even project posts across the Internet. Unfortunately, many are in limbo because I cannot remember where they are at. If anyone knows of an open thread or an unanswered inquiry, please PM me. Thank you.
   
Notice: Unless stated otherwise, I receive no compensation for anything I post here.
« Last Edit: December 10, 2009, 07:01 AM by CodeTRUCKER »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • Participated in NANY Challenge Twice
Re: Help with Delphi Console Keypress
« Reply #9 on: January 06, 2007, 02:37 AM »
Correction, I wasn't remembering clearly:

When you declare a var as AnsiString in Delphi, you get the old-style statically allocated string with max length of 255.

The above is wrong. Here's what really happens: when you declare a var as AnsiString, you do get the "huge" string variety. This does not depend on the "Huge strings" compiler switch, since you're explicitly asking for one. The compiler switch only affects declarations of "var s : string;"

But as mouser said, please give a bit more info on your code and the specific error.

Original address: https://www.donationcoder.com/forum/index.php?topic=6625.0