Gambas-it

Gambas3 => Segnalazione bug => Topic aperto da: vuott - 16 Luglio 2019, 23:29:02

Titolo: [risolto] Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: vuott - 16 Luglio 2019, 23:29:02
Potete verificare se il Metodo .Extract( ) dell'oggetto ListBox funziona regolarmente ?
A me pare di no.
Titolo: Re:Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: Gianluigi - 17 Luglio 2019, 08:36:36
Sei sicuro che questo metodo esista?  :-\
Titolo: Re:Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: vuott - 17 Luglio 2019, 11:30:18
Parlo di questo:

ListBox1.List.Extract()
Titolo: Re:Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: Gianluigi - 17 Luglio 2019, 11:52:33
Si scusa hai ragione, confermo non funziona.
Mentre per l'array String funziona.
Titolo: Re:Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: vuott - 17 Luglio 2019, 12:08:58
Infatti.
Titolo: Re:[risolto] Possibile bug nel Metodo .Extract( ) di ListBox
Inserito da: vuott - 17 Luglio 2019, 17:37:20
Dunque, mi è stato risposto quanto segue (quindi non c'è alcun bug):

" This is deliberate. The List property of ListBox returns a *copy* of the internal
string array, so any change you make is done to the copy. This is often done in
Gambas to prevent code from outside of an object to mess with its internal state.
If you extract elements from the List object directly, the object is not notified
of a change being made to its data, so it won't update its GUI accordingly.
You should assign the result of .List.Extract back into .List. Assignment to a
property is something an object is notified of.
You can imagine that there are other scenarios where objects want to only return
value copies of their internal state. Basically anytime the object makes assumptions
on and relies on the integrity of its state.
"