Article ID: 130725
Article Last Modified on 2/11/2000
Property What to Type in the Property Sheet ------------------------------------------------------------------------ BackColor 192,192,192 Caption Enter Number of Controls Unload Event RETURN nValue &&This is the value the form returns WindowType 1-Modal
Property Type in the Property Sheet ------------------------------------------------------------------------ ControlSource nValue KeyboardHighvalue 10 KeyboardLowValue 1 SpinnerHighValue 10 SpinnerLowValue 1
Property Type in the Property Sheet ------------------------------------------------------------------------ Caption OK Click Event RELEASE ThisForm
*: CLONEOBJ
DO Form CloneObj TO nNumberofControls
CREATE Form test2 NOWAIT
=ASELOBJ(atest,1) && Place the name of the form in an array.
atest(1).Caption="See the new controls on the Form"
atest(1).LockScreen=.T. && Changes are refreshed all at once
=MESSAGEBOX('There is no control')
* Define the first command button:
atest(1).AddObject('mycmd1','CommandButton')
atest(1).mycmd1.ForeColor=RGB(0,0,255)
* Duplicate the first command button, and store the name of the
* previous command button to position the new control relative to the
* position of the previous command button:
FOR I=2 TO nNumberofControls
OldName='Mycmd'+ALLTRIM(STR(I-1))
NewName='Mycmd'+ALLTRIM(STR(I))
atest(1).mycmd1.CloneObject(NewName) && Duplicate command button.
oref=EVALUATE('atest(1).'+NewName)
oOldref=EVALUATE('atest(1).'+OldName)
oref.Top=oOldref.Top+35
oref.Caption=NewName
ENDFOR
atest(1).SetAll('Visible',.T.,'CommandButton')
atest(1).Refresh
=MESSAGEBOX('Now there are '+ ALLTRIM(STR(nNumberofControls))+ ;
' controls')
Additional query words: VFoxWin
Keywords: kbcode KB130725