MAIN.PRG * * Create MyForm and make it visible * oForm = CREATEOBJECT('MyForm') oForm.Show() * * Process Events * READ EVENTS * * All done * MessageBox('Test Complete!') RETURN * * MyForm class * DEFINE CLASS MyForm AS FORM AutoCenter = .t. Caption = [Press the "Test" button to test it's "Click Event"] PROCEDURE Init * * Add MyButton to the form * this.AddObject('cmdButton1','MyButton') * * Center it * WITH this.cmdButton1 .Top = (thisform.Height/2) - (.Height/2) .Left = (thisform.Width/2) - (.Width/2) .Visible = .t. ENDWITH ENDPROC PROCEDURE Destroy * * Return control to the line in the MAIN.PRG after the READ EVENTS * CLEAR EVENTS ENDPROC ENDDEFINE * * MyButton class * DEFINE CLASS MyButton AS COMMANDBUTTON Height = 22 Width = 80 Caption = 'Test' PROCEDURE Click MessageBox('Test') ENDPROC ENDDEFINE