Recent

Author Topic: ASCII #32  (Read 7943 times)

LazaruX

  • Hero Member
  • *****
  • Posts: 597
  • Lazarus original cheetah.The cheetah doesn't cheat
ASCII #32
« on: December 10, 2008, 12:50:34 pm »
Code: [Select]
[...]
procedure TForm_Main.edit_nrKeyPress(Sender: TObject; var Key: char);
begin
 if(key=#13)or(key=#32)then
  begin
   Action_.Execute;
   edit_nr.Clear;
  end;
end;  
[...]


This is part of my code, the #13 charachter (enter) is working, but the #32 charachter (space) is not working, even if i change it like this:

Code: [Select]
if(key=#32)then


Any suggestions? Is this a bug, or what.
I need to have a respons when ENTER or SPACE are pressed.

Bye

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
RE: ASCII #32
« Reply #1 on: December 10, 2008, 02:10:34 pm »
Try printing it, e.g.:
Code: [Select]

...
begin
  ShowMessage(IntToStr(Ord(Key));
  if...
end;

LazaruX

  • Hero Member
  • *****
  • Posts: 597
  • Lazarus original cheetah.The cheetah doesn't cheat
ASCII #32
« Reply #2 on: December 10, 2008, 02:38:43 pm »
Hi, thanks I have solved it.
I actually have 2 semi identical parts of the program and I had coded it behind the wrong event, this is why it never worked. The showmessage then also didn't work, so I though there was something wrong.
Thanks again

 

TinyPortal © 2005-2018