Página 1 de 1

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 7:42 pm
por Dionisis Divaris
Hello Jose , Ignacio
Something strange happens with the TOptionList:aItems Property.
In the include sample try the following when compiled.
1st- Press the first button to insert 4 new Items in the OptionList.
2nd- Press the other button to delete the 4 inserted Items
As you can see the MsgInfo Box inform us with the correct array (aItems)
length. But when going to delete those 4 inserted items only the 1st and 3rd
items
deleted only.
What happens am i missing something??
Regards
Dionisis


Attached files Bulk.rar (1.9 KB)Â

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:14 pm
por joseluis
Dionisis,
Here you are what you wanted to do. Look at method itemsdeletion.
Regards,
José Luis Capel
Dionisis Divaris escribió:
> Hello Jose , Ignacio
>
> Something strange happens with the TOptionList:aItems Property.
>
> In the include sample try the following when compiled.
>
> 1st- Press the first button to insert 4 new Items in the OptionList.
> 2nd- Press the other button to delete the 4 inserted Items
>
> As you can see the MsgInfo Box inform us with the correct array (aItems)
> length. But when going to delete those 4 inserted items only the 1st and 3rd
> items
> deleted only.
>
> What happens am i missing something??
>
>
> Regards
> Dionisis
>
>
>
--

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:14 pm
por joseluis
Dionisis,
Here you are what you wanted to do. Look at method itemsdeletion.
Regards,
José Luis Capel
Dionisis Divaris escribió:
> Hello Jose , Ignacio
>
> Something strange happens with the TOptionList:aItems Property.
>
> In the include sample try the following when compiled.
>
> 1st- Press the first button to insert 4 new Items in the OptionList.
> 2nd- Press the other button to delete the 4 inserted Items
>
> As you can see the MsgInfo Box inform us with the correct array (aItems)
> length. But when going to delete those 4 inserted items only the 1st and 3rd
> items
> deleted only.
>
> What happens am i missing something??
>
>
> Regards
> Dionisis
>
>
>
--

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:27 pm
por jfgimenez
Dionisis,
> Something strange happens with the TOptionList:aItems Property.
>
> In the include sample try the following when compiled.
>
> 1st- Press the first button to insert 4 new Items in the OptionList.
> 2nd- Press the other button to delete the 4 inserted Items
>
> As you can see the MsgInfo Box inform us with the correct array (aItems)
> length. But when going to delete those 4 inserted items only the 1st and
> 3rd
> items
> deleted only.
>
> What happens am i missing something??
The problem is that in the second pass, there is only 3 items left, and the
second item is the original third one. Let's see each iteration (all items
are named by its original pos):
# items item to delete items left
--- ------ -------------- ---------
1 1,2,3,4 1 2,3,4
2 2,3,4 3 2,4
3 3,4 - 2,4
4 4 - 2,4
The correct way to delete the desired items is doing it in reverse order,
that is: FOR n := Len( :aItems ) TO 1 STEP -1
Or like Jose Luis has just pointed: WHILE Len( :aItems ) > 0 ; and deleting
the first item in each iteration.
--
Regards,
Jose F. Gimenez

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:27 pm
por jfgimenez
Dionisis,
> Something strange happens with the TOptionList:aItems Property.
>
> In the include sample try the following when compiled.
>
> 1st- Press the first button to insert 4 new Items in the OptionList.
> 2nd- Press the other button to delete the 4 inserted Items
>
> As you can see the MsgInfo Box inform us with the correct array (aItems)
> length. But when going to delete those 4 inserted items only the 1st and
> 3rd
> items
> deleted only.
>
> What happens am i missing something??
The problem is that in the second pass, there is only 3 items left, and the
second item is the original third one. Let's see each iteration (all items
are named by its original pos):
# items item to delete items left
--- ------ -------------- ---------
1 1,2,3,4 1 2,3,4
2 2,3,4 3 2,4
3 3,4 - 2,4
4 4 - 2,4
The correct way to delete the desired items is doing it in reverse order,
that is: FOR n := Len( :aItems ) TO 1 STEP -1
Or like Jose Luis has just pointed: WHILE Len( :aItems ) > 0 ; and deleting
the first item in each iteration.
--
Regards,
Jose F. Gimenez

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:29 pm
por jfgimenez
Dionisis,
excuse me. The correct iteration map is:
# items item to delete items left
--- ------ -------------- ---------
1 1,2,3,4 1 2,3,4
2 2,3,4 3 2,4
At this point, Len( :aItems ) = 2, and the FOR statement ends.
--
Regards,
Jose F. Gimenez

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 8:29 pm
por jfgimenez
Dionisis,
excuse me. The correct iteration map is:
# items item to delete items left
--- ------ -------------- ---------
1 1,2,3,4 1 2,3,4
2 2,3,4 3 2,4
At this point, Len( :aItems ) = 2, and the FOR statement ends.
--
Regards,
Jose F. Gimenez

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 10:33 pm
por Dionisis Divaris
Understood 100%
Many thanks to all of you
Regards
Dionisis
Ï "Jose F. Gimenez" <jfgimenez@wanadoo.es> Ýãñáøå óôï ìÞíõìá
news:44340c73$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
> Dionisis,
>
> excuse me. The correct iteration map is:
>
> # items item to delete items left
> --- ------ -------------- ---------
> 1 1,2,3,4 1 2,3,4
> 2 2,3,4 3 2,4
>
> At this point, Len( :aItems ) = 2, and the FOR statement ends.
>
> --
> Regards,
>
> Jose F. Gimenez
>

Something strange happens with the TOptionList:aItems

Publicado: Mié Abr 05, 2006 10:33 pm
por Dionisis Divaris
Understood 100%
Many thanks to all of you
Regards
Dionisis
Ï "Jose F. Gimenez" <jfgimenez@wanadoo.es> Ýãñáøå óôï ìÞíõìá
news:44340c73$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
> Dionisis,
>
> excuse me. The correct iteration map is:
>
> # items item to delete items left
> --- ------ -------------- ---------
> 1 1,2,3,4 1 2,3,4
> 2 2,3,4 3 2,4
>
> At this point, Len( :aItems ) = 2, and the FOR statement ends.
>
> --
> Regards,
>
> Jose F. Gimenez
>