[Gambas-user] Enter a name at the beginning of a list of names

PICCORO McKAY Lenz mckaygerhard at gmail.com
Wed May 30 16:00:08 CEST 2018


noted that when we need a solution the list are here, but answers comes
almost later..

we need something that serach engines like yandex and google can track to
find common solutions

the answwer of Tobias are great and very helpfull.. but comes 17 hours
later, a entire day of work later

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2018-05-30 9:33 GMT-04:00 Tobias Boege <taboege at gmail.com>:

> On Tue, 29 May 2018, Gianluigi wrote:
> > If we want to insert a name in a ListView of names we have the
> possibility
> > to do it with the fourth entry of the Add(....) method.
> > But what if we have to insert it as the first name?
> > Do I miss some other method?
> > Do you have any better ideas than the one in my attached project?
> >
>
> This is quicker:
>
>   ListView1.Add(Key, Text).MoveFirst()
>
> but there doesn't seem to be a way to request that an item be added
> *before*
> some other item, or at the beginning. It's an asymmetric interface.
> (Although in the backend of ListView's implementation, there *is* a flag
> which lets you put elements before, not after, the given reference item).
>
> Regards,
> Tobi
>
> PS: Generating keys via CStr(ListView1.Count) only works as long as you
> never delete anything from the ListView. I often use a ListView for display
> purposes only and don't care about keys either. Letting the ListView
> generate a unique key in case the Key argument to ListView.Add() is Null
> is a nice task for someone's first contribution to Gambas... ;-)
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180530/3cfba2a2/attachment.html>


More information about the User mailing list