Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove Objects from a Form
Message
De
02/09/2005 12:11:12
 
 
À
02/09/2005 08:53:18
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01046174
Message ID:
01046271
Vues:
15
>Dear All,
>
>I append several objects programmatically, how can I remove it "automatically"?
>e.g.
>
>nEditBox1
>nEditBox2
>nEditBox3... nEditBox999
>
>How can I issue a command to remove them all?
>
>
>FOR x = 1 TO 999
>    nLabel = EVALUATE([nEditBox]+TRANSFORM(x))
>    f_form.removeobject(nLabel)
>ENDFOR
>
>
>However, I don't know how many EditBox I added beforehand...?!

If you append a array of equal objects:
WITH CREATEOBJECT("form")
	.AddProperty("nEditBox[99]",null)
	* add
	FOR k=1 TO 99
		.AddObject(TRANSFORM(k,"@R nEditBox[99]"),"editbox_")
		WITH .nEditBox[k]
			.Memberindex=m.k
			.Move(RAND()*(.parent.Width-.Width),RAND()*(.parent.height-.height))
		ENDWITH
	NEXT
	.setAll("Visible",.t.)
	.setAll("Anchor",15)
	.Show(1)
	* remove all
	.nEditBox = NULL
ENDWITH

DEFINE CLASS editbox_ as EditBox
	Memberindex=0
	PROCEDURE Click
		thisform.Caption ="member "+trans(this.Memberindex)
ENDDEFINE 
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform