Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Issue: Collection.Clear(), I don't find it.
Message
From
13/05/2005 08:51:31
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01013756
Message ID:
01013813
Views:
15
>Rediculous is that they go through all items for removing them espscialy when they know that you want to remove ALL.
>As Fabio said what happens if you want to claer all items in collection when the collection has 100000 items?

Hi Borislav,

Sorry, but i don't agree with you here.
I Expected Clear or Remove(0) syntax only
Remove(-1) implementation is correct ,
because into any environment,
the destruction must have the opposite order of the construction.

With a objects array, you can respect this rule with loop reverse code only
( except others issues )
clear

DIMENSION oArray[10]

el=SET("Eventlist")

SET EVENTLIST TO init,Destroy
SET EVENTTRACKING TO SYS(2023)+'\track.log'
SET EVENTTRACKING ON

FOR k=1 TO ALEN(oArray)
	oArray[m.k]=CREATEOBJECT("Exception")
	oArray[m.k].name = '_'+TRANSFORM(m.k)
NEXT
oArray=NULL

FOR k=1 TO ALEN(oArray)
	oArray[m.k]=CREATEOBJECT("Exception")
	oArray[m.k].name = '_'+TRANSFORM(m.k)
NEXT
RELEASE oArray


SET EVENTTRACKING OFF
SET EVENTTRACKING TO 
SET EVENTLIST TO &el

MODIFY FILE SYS(2023)+'\track.log'
ERASE SYS(2023)+'\track.log'
Of course, without objects and events, the destruction's order is hidden within the
engine black box ( combo, ... ).

True,
Collection.Add( eItem [, cKey [, [eBefore |, eAfter ]]] )
have eBefore and eAfter ,
that they allow to change the temporal sequence of the past,
but you can do this in Objects collection too, using ZOrder().

Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform