Página 1 de 1
Add control at run-time
Publicado: Sab Ago 05, 2006 2:31 pm
por Srdjan
I create one blank window dialog at run-time I must add indefinete number of
editboxs. How I can create this ?
Add control at run-time
Publicado: Lun Ago 07, 2006 1:16 pm
por jfgimenez
Srdjan,
>I create one blank window dialog at run-time I must add indefinete number
>of
> editboxs. How I can create this ?
Just declare an array to hold the controls. For example:
CLASS TForm1 FROM TForm
...
DATA aEditControls INIT {}
ENDCLASS
METHOD FormInitialize( oSender ) CLASS TForm1
LOCAL oEdit
WITH OBJECT oEdit := TEdit():New( Self )
...
:Create()
END
AAdd( ::aEditControls, oEdit )
RETURN Nil
BTW, there is already an array that hold all the controls in a form:
aControls. But sometimes is better to create another array, just to avoid
mix the derired controls with other ones.
--
Regards,
Jose F. Gimenez
http://www.xailer.com