Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 08, 2016, 03:55:17 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Help with Delphi Console Keypress  (Read 5055 times)

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,060
    • View Profile
    • Donate to Member
Help with Delphi Console Keypress
« on: December 19, 2006, 02:18:04 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.
« Last Edit: December 10, 2009, 12:53:52 AM by CodeTRUCKER »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,412
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #1 on: December 19, 2006, 02:23:17 PM »
dont make a console application; make a form, then you can catch all the keystrokes in a nice event.

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,060
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #2 on: December 19, 2006, 02:35:14 PM »
Alright, no console.  Anyone else want to chime in?
« Last Edit: December 10, 2009, 12:52:22 AM by CodeTRUCKER »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #3 on: December 19, 2006, 05:10:25 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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,060
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #4 on: December 19, 2006, 05:31:36 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.
« Last Edit: December 10, 2009, 12:49:16 AM by CodeTRUCKER »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,079
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #5 on: December 20, 2006, 09:33:39 AM »

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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,060
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #6 on: December 21, 2006, 01:12:23 AM »
Thank you.  I will give it a try and get back.
« Last Edit: December 10, 2009, 12:55:58 AM by CodeTRUCKER »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,412
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #7 on: December 21, 2006, 05:08:47 AM »
maybe you can tell us more about the "error" you are getting, to help us help you figure out what it is.

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,060
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #8 on: December 21, 2006, 06:05:44 AM »
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.
« Last Edit: December 10, 2009, 01:01:46 AM by CodeTRUCKER »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,079
    • View Profile
    • Donate to Member
Re: Help with Delphi Console Keypress
« Reply #9 on: January 05, 2007, 08:37:12 PM »
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.