11/09/2002 5:56:57 p.m., "Moretti, Giovanni" <[EMAIL PROTECTED]> wrote:
>We have this tiny program for a form. It has an edit box and an OK button. See the 'default' and 'cancel' properties of a button in the documentation. > >Putting the cursor into the Edit Box and pressing <Enter> should (according to the >following code) cause the dialog box to turn White, but before it does so the OK BUTTON Click Handler is called and turns the form RED. > >We're not clicking the OK Button just pressing Enter so why is the handler called? > >The Form is called OKBottomDlg: > >==================================================================== >procedure TOKBottomDlg.Edit1KeyUp(Sender: TObject; var Key: Word; > Shift: TShiftState); >begin > if ord(key) = 13 then {it's a return character} > color := clWhite; >end; > >procedure TOKBottomDlg.OKBtnClick(Sender: TObject); >begin > color := clRed; >end; > >==================================================================== > >The complete project can be downloaded from: > http://www-ist.massey.ac.nz/GMoretti/OKButtonTest.zip > >How can we stop the Click handler from being called when <enter> is pressed? > >Thanks >Giovanni >________________________________________________________________________ >Giovanni Moretti | Institute of Information Sciences and Technology >Senior Lecturer | Massey University, Palmerston North, New Zealand >Computer Science | Ph 64-6-3505799x2474 == Fax 64-6-3502259 == ZL2BOI >------------------------------------------------------------------------ >http://www-ist.massey.ac.nz/Giovanni >--------------------------------------------------------------------------- > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz >To UnSub, send email to: [EMAIL PROTECTED] >with body of "unsubscribe delphi" >Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/