[Gambas-user] ListView.add

Benoit Minisini gambas at ...1...
Sat Dec 3 17:57:08 CET 2005


On Saturday 03 December 2005 13:42, BernieMan wrote:
> Hello All,
> I have a few questions:
>
> I try to add an item with a button to a listview-element.
> It is working once.
>
> But when I tried it a second time ist says that
> the key already exists.
> So far so good ...
>
> - How can I find out the highest key-Value?
> - Or is there an easy way to add an item and to create an unused key ?
>
> thx in advance
> BernieMan
>

*You* choose the key, so you can do what you want :-)

There is not "highest" key value, as key is a string. But as Gambas 
automatically convert numbers into strings when needed, you can use a global 
variable to store a numeric value that you increment each time you add an 
item, and that you use as a key:

INC MyCounter
MyListView.Add(MyCounter, "text", ... )

Regards,

-- 
Benoit Minisini





More information about the User mailing list