Q for hubdog & inthe

Hey, guys!
The Key := 0 does not work!!
I just tested it and I still get the beep!

:-(
LVL 1
Oli2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
used on keypress event it does:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if (key = #13) then key := #0;
//keypress does work to disable it.
end;

procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if (key = ord(13)) then key := 0;
//keydown dont work to disable it.
end;

end.


try that 1 works ... one dont ;-)
Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Oli2Author Commented:
Hi, Barry!
Thanx!
This is strange:

if you just have a
procedure KeyDown (blabla);
begin

end;

it will beep when getting to "end;"

if you have a
procedure KeyPress(blabla);
 in addition to  the KeyDown procedure,
it runs over the "end;" of the KeyDown procedure without
beeping.
(KeyDown gets handled before KeyPress it seems)


Anyway, thanx again for your help!

Regards, Oli
0
intheCommented:
yes thats true

keydown
keypress
keyup
is probably the  order .

mm..maybe
keydown
keyup
keypress  
          ;-)
         
0
Oli2Author Commented:
in case of keydown-keyup-keypress, it
should be named KeyWasPressed instead of KeyPress, huh?
;-)
0
intheCommented:
hehe true,
   ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.