Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-01

Swopping two items in TCollection

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Wimpie Nortje

Hi list

I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem is of type TList which has an exchange function, but that is private and not accessable to me.

Michael Van Canneyt
to Wimpie Nortje
Wimpie Nortje wrote 6 lines
Hi list I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem is of type TList which has an exchange function, but that is private and not accessable to me.

You can set the Items' Index property.

Maybe we should introduce a method Exchange(I,J : Integer) which does this automatically in 1 go.

Michael.

Wimpie Nortje
to Michael Van Canneyt

Thanks.

An exhange() would be usefull. Should I file a bug report?

Michael Van Canneyt wrote 22 lines
On Thu, 14 Jan 2010, Wimpie Nortje wrote: > Hi list > > I have a class derived from Tcollection, holding items derived from > TCollectionItem. How do I swop two items in the collection? FItem is > of type TList which has an exchange function, but that is private and > not accessable to me. You can set the Items' Index property. Maybe we should introduce a method Exchange(I,J : Integer) which does this automatically in 1 go. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Michael Van Canneyt
to Wimpie Nortje

Please do, this way we won't forget it.

Michael.

Wimpie Nortje wrote 30 lines
Thanks. An exhange() would be usefull. Should I file a bug report? Michael Van Canneyt wrote: > > > On Thu, 14 Jan 2010, Wimpie Nortje wrote: > >> Hi list >> >> I have a class derived from Tcollection, holding items derived from >> TCollectionItem. How do I swop two items in the collection? FItem is of >> type TList which has an exchange function, but that is private and not >> accessable to me. > > You can set the Items' Index property. > > Maybe we should introduce a method Exchange(I,J : Integer) which does this > automatically in 1 go. > > Michael. > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Wimpie Nortje
to Michael Van Canneyt

Done.

http://bugs.freepascal.org/view.php?id=15517

Michael Van Canneyt wrote 43 lines
Please do, this way we won't forget it. Michael. On Thu, 14 Jan 2010, Wimpie Nortje wrote: > Thanks. > > An exhange() would be usefull. Should I file a bug report? > > Michael Van Canneyt wrote: >> >> >> On Thu, 14 Jan 2010, Wimpie Nortje wrote: >> >>> Hi list >>> >>> I have a class derived from Tcollection, holding items derived from >>> TCollectionItem. How do I swop two items in the collection? FItem >>> is of type TList which has an exchange function, but that is >>> private and not accessable to me. >> >> You can set the Items' Index property. >> >> Maybe we should introduce a method Exchange(I,J : Integer) which >> does this >> automatically in 1 go. >> >> Michael. >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal