Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with key codes

ccavemanccaveman Posts: 1Member
This is the key code I need to know:

what is the key code for "enter"?

eg. Shift key is 0

Comments

  • zibadianzibadian Posts: 6,349Member
    : This is the key code I need to know:
    :
    : what is the key code for "enter"?
    :
    : eg. Shift key is 0
    :
    13
  • IDKIDK Posts: 1,784Member
    : : This is the key code I need to know:
    : :
    : : what is the key code for "enter"?
    : :
    : : eg. Shift key is 0
    : :
    : 13
    :
    I don't know pascall, so if this seems completly wrong then don't read it ;-)

    No, 13 is the ascii for newline, the makecode for Enter is 36.
    What does keycode really mean?
    The return value of INT 21h,1 (aka getc() in C in windows)?
  • zibadianzibadian Posts: 6,349Member
    : : : This is the key code I need to know:
    : : :
    : : : what is the key code for "enter"?
    : : :
    : : : eg. Shift key is 0
    : : :
    : : 13
    : :
    : I don't know pascall, so if this seems completly wrong then don't read it ;-)
    :
    : No, 13 is the ascii for newline, the makecode for Enter is 36.
    : What does keycode really mean?
    : The return value of INT 21h,1 (aka getc() in C in windows)?
    :
    13 isn't newline, but cariage return (returns cursor to first character). newline is 10. The distinction comes from the old mechanical type-writers. The string 'abc'#10'def' should look like this:
    [code]
    abc
    def
    [/code]
    while 'abc'#13'def' is
    [code]
    def
    [/code]
    and 'abc'#13#10'def' and 'abc'#10#13'def':
    [code]
    abc
    def
    [/code]
    KeyCode is the code, which is returned by the ReadKey() function. This function maps the "normal" keys to ASCII mapping, while the extended keys are mapped in a 16-bit code space.

  • IDKIDK Posts: 1,784Member
    : : I don't know pascall, so if this seems completly wrong then don't read it ;-)
    : :
    : : No, 13 is the ascii for newline, the makecode for Enter is 36.
    : : What does keycode really mean?
    : : The return value of INT 21h,1 (aka getc() in C in windows)?
    : :
    : 13 isn't newline, but cariage return (returns cursor to first character). newline is 10. The distinction comes from the old mechanical type-writers. The string 'abc'#10'def' should look like this:

    Oops, I mixed them up...

    : KeyCode is the code, which is returned by the ReadKey() function. This function maps the "normal" keys to ASCII mapping, while the extended keys are mapped in a 16-bit code space.
    :
    :
    OK, so then it's eqvivalent with INT 21h,1

    Thanks and happy programming!!!
Sign In or Register to comment.