In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Something strange happens with the TOptionList:aItems

Xailer professional forum in English
Responder
Avatar de Usuario
Dionisis Divaris
Mensajes: 485
Registrado: Jue Jul 12, 2007 8:48 pm
Ubicación: Athens Greece

Something strange happens with the TOptionList:aItems

Mensaje 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)Â
T.I.A
Dionisis
SGS-soft
support.sgs@gmail.com
joseluis
Mensajes: 642
Registrado: Jue Sep 08, 2005 12:54 pm

Something strange happens with the TOptionList:aItems

Mensaje 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
>
>
>
--
joseluis
Mensajes: 642
Registrado: Jue Sep 08, 2005 12:54 pm

Something strange happens with the TOptionList:aItems

Mensaje 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
>
>
>
--
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Something strange happens with the TOptionList:aItems

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Something strange happens with the TOptionList:aItems

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Something strange happens with the TOptionList:aItems

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Something strange happens with the TOptionList:aItems

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
Dionisis Divaris
Mensajes: 485
Registrado: Jue Jul 12, 2007 8:48 pm
Ubicación: Athens Greece

Something strange happens with the TOptionList:aItems

Mensaje 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
>
T.I.A
Dionisis
SGS-soft
support.sgs@gmail.com
Avatar de Usuario
Dionisis Divaris
Mensajes: 485
Registrado: Jue Jul 12, 2007 8:48 pm
Ubicación: Athens Greece

Something strange happens with the TOptionList:aItems

Mensaje 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
>
T.I.A
Dionisis
SGS-soft
support.sgs@gmail.com
Responder