** TestUT.prg ox = CreateObject("testform") ox.Show() Read Events Define Class testform As form Height = 200 Width = 200 Add Object Text1 As textbox Add Object cmdCancel As commandbutton With ; Caption = "Cancel", ; Cancel = .T. Procedure Init *-- center textbox as button With this .cmdCancel.Left = .Width/2 - .cmdCancel.Width/2 .cmdCancel.Top = .Height - .cmdCancel.Height - 5 .Text1.Left = .Width/2 - .Text1.Width/2 .Text1.Top = .Height/2 - .Text1.Height/2 EndWith EndProc Procedure Destroy Clear Events EndProc Procedure Text1.Valid If LastKey() <> 27 Return !"-" $ this.Value EndIf EndProc Procedure cmdCancel.Click thisform.Release() EndProc EndDefine