Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove Objects from a Form
Message
De
03/09/2005 08:03:43
 
 
À
03/09/2005 07:19:29
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01046174
Message ID:
01046535
Vues:
20
>>>>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 they're from same class you can brodacast a message to tell them to remove themselves. ie:
>>>
>>>*Custom property Action
>>>*Action_assign
>>>lparameters vNewVal
>>>if vNewVal='destroy' and type('this.parent')='O'
>>>   this.parent.RemoveObject(this.name)
>>>endif
>>>
>>>thisform.SetAll('Action','destroy','myClass')
>>>
Cetin
>>
>>Hi Cetin,
>>when I have seen this code
>>I thought that VFP collapsed with two or more objects,
>>because when it remove the first one,
>>all the indexes of the collection move back him of one
>>(the collections of VFP are implemented as array,
>>and this is a coarse error,
>>correct implementation it is with a linked list ....)
>>but enough an only object to make to collapse VFP,
>>because when VFP goes out of Broadcast_Assign all the pointers C++ they are corrupt,
>>and when the routine c++ looks for the following one it goes out a violation of memory.
>>
>>
>>PUBLIC oform1
>>
>>oform1=NEWOBJECT("form1")
>>oform1.Show
>>
>>DEFINE CLASS form1 AS form
>>
>>	ADD OBJECT tx2 AS tx WITH ;
>>		Left = 79, ;
>>		Top = 115, ;
>>		Name = "Tx2"
>>
>>	PROCEDURE Click
>>		Thisform.SetAll("BroadCast",.f.)
>>	ENDPROC
>>
>>ENDDEFINE
>>
>>DEFINE CLASS tx AS textbox
>>
>>	broadcast = .F.
>>
>>	HIDDEN PROCEDURE broadcast_assign
>>		LPARAMETERS vNewVal
>>		this.Parent.RemoveObject(this.Name)
>>		WAIT WINDOW "don't touch nothing or me I die"
>>	ENDPROC
>>
>>ENDDEFINE
>>
>
>Fabio,
>You're right as always:)
>Cetin

Cetin,
As I am right on things done evil that I have to use, I would prefer to be wrong:)
Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform