oForm = createobject("Form") >>with oForm >> .addobject("MyoptGrp","Optiongroup") >> with .MyoptGrp >> .buttoncount = 5 >> for ix = 1 to 5 >> .removeobject("Option"+ltrim(str(ix))) >> .addobject("Option"+ltrim(str(ix)),"myoption",; >> "Hello"+ltrim(str(ix)), ix) >> endfor >> .setall("Visible",.t.) >> .autosize = .t. >> .visible = .t. >> endwith >> .addobject("myquitter","myquit") >> .myquitter.visible = .t. >>endwith >>oForm.show >>read events >> >>define class myoption as optionbutton >> fontname = "Arial" >> fontbold = .t. >> fontitalic = .t. >> autosize = .t. >> procedure init >> lparameters tcCaption, tnPos >> this.caption = tcCaption >> this.left = 1 >> this.Top = tnPos * (this.height + 2) >> endproc >> >> procedure click >> =rand(-1) >> this.forecolor = rgb(int(rand()*255), ; >> int(rand()*255), ; >> int(rand()*255)) >> endproc >>enddefine >> >>define class myquit as commandbutton >>Autosize = .T. >>Caption="Close" >>procedure init >> this.left = this.parent.width - this.width - 2 >> this.top = this.parent.height - this.height - 2 >>endproc >>procedure click >> release all >> clear events >>endproc >>enddefineCetin
*myoptiongroupbuild.prg * Maybe an interface here to get buttoncount etc aselobj(aOptionGrp) with aOptionGrp[1] .buttoncount = lnButtons for ix = 1 to lnButtons .removeobject("Option"+ltrim(str(ix))) .addobject("Option"+ltrim(str(ix)),"myoption") endfor .autosize = .t. endwith define class myoption as optionbutton * PEM code enddefineIf you register this to builder.dbf it would be a builder also (would need 3 dummy parameters for builder.app).