*!* Begin Code PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (c:\nec\library\classes\showcontrolcount.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 11/22/99 06:28:08 PM * DEFINE CLASS form1 AS form DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT command1 AS commandbutton WITH ; Top = 8, ; Left = 8, ; Height = 27, ; Width = 104, ; Caption = "Count Controls!", ; Name = "Command1" ADD OBJECT commandgroup1 AS commandgroup WITH ; ButtonCount = 2, ; Value = 1, ; Height = 66, ; Left = 271, ; Top = 148, ; Width = 94, ; Name = "Commandgroup1", ; Command1.Top = 5, ; Command1.Left = 5, ; Command1.Height = 27, ; Command1.Width = 84, ; Command1.Caption = "Command1", ; Command1.Name = "Command1", ; Command2.Top = 34, ; Command2.Left = 5, ; Command2.Height = 27, ; Command2.Width = 84, ; Command2.Caption = "Command2", ; Command2.Name = "Command2" ADD OBJECT optiongroup1 AS optiongroup WITH ; ButtonCount = 2, ; Value = 1, ; Height = 46, ; Left = 262, ; Top = 73, ; Width = 71, ; Name = "Optiongroup1", ; Option1.Caption = "Option1", ; Option1.Value = 1, ; Option1.Height = 17, ; Option1.Left = 5, ; Option1.Top = 5, ; Option1.Width = 61, ; Option1.Name = "Option1", ; Option2.Caption = "Option2", ; Option2.Height = 17, ; Option2.Left = 5, ; Option2.Top = 24, ; Option2.Width = 61, ; Option2.Name = "Option2" ADD OBJECT pageframe1 AS pageframe WITH ; ErasePage = .T., ; PageCount = 2, ; Top = 76, ; Left = 11, ; Width = 241, ; Height = 169, ; Name = "Pageframe1", ; Page1.Caption = "Page1", ; Page1.Name = "Page1", ; Page2.Caption = "Page2", ; Page2.Name = "Page2" ADD OBJECT grid1 AS grid WITH ; Height = 56, ; Left = 155, ; Top = 5, ; Width = 211, ; Name = "Grid1" PROCEDURE countup LPARAMETER toObject LOCAL lnCount, loO, lcBaseClass lnCount = 0 lcBaseClass = UPPER( toObject.baseClass ) DO CASE CASE lcBaseClass = 'PAGEFRAME' FOR EACH loO IN toObject.Pages lnCount = lnCount + thisform.CountUp( loO ) NEXT loO CASE INLIST( lcBaseClass, 'CONTAINER', 'FORM', 'PAGE' ) FOR EACH loO IN toObject.Controls lnCount = lnCount + thisform.CountUp( loO ) NEXT loO CASE INLIST( lcBaseClass, 'COMMANDGROUP', 'OPTIONGROUP' ) FOR EACH loO IN toObject.Buttons lnCount = lnCount + thisform.CountUp( loO ) NEXT loO CASE lcBaseClass = 'GRID' FOR EACH loO IN toObject.Columns lnCount = lnCount + thisform.CountUp( loO ) NEXT loO CASE lcBaseClass = 'FORMSET' FOR EACH loO IN toObject.Forms lnCount = lnCount + thisform.CountUp( loO ) NEXT loO ENDCASE lnCount = lnCount + 1 RETURN lnCount ENDPROC PROCEDURE command1.Click local lni lni = 0 lni = thisform.countup(thisform) messagebox( str(lni) ) ENDPROC ENDDEFINE * *-- EndDefine: form1 ************************************************** *!* End Code