Hopefully simple addition to AddGadgetItem()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Lars
User
User
Posts: 31
Joined: Sat Sep 27, 2003 5:54 pm
Location: Bonn, Germany
Contact:

Hopefully simple addition to AddGadgetItem()

Post by Lars »

Working with the -1 position parameter of AddGadgetElement(), i realised
that it would be very cool, if AddGadgetElement() would simply return the
final position of the new element. I don't know how PB works internally,
but imho this shouldn't be much work to do, but it would be a great
improvement of comfort :)

For example, if you want to add an element to a listicongadget and want
to do something with this new added item later on. At the moment you
have to keep track of the positions on you own, which is not very cool.

Thanks,

Lars
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

If using -1 as position parameter, the new item will be at the position "CountGadgetItems()-1". Where's the problem?
quidquid Latine dictum sit altum videtur
Lars
User
User
Posts: 31
Joined: Sat Sep 27, 2003 5:54 pm
Location: Bonn, Germany
Contact:

Post by Lars »

Errrrm, it's a shame, but i didn't realise this possibility yet :oops:

Whatever, it would be kind of usefull though, but it's not really important.
Lars
The only problem with troubleshooting is that sometimes the trouble shoots back.
P4 3Ghz, 512MB RAM, Radeon 9600Pro, WinXP Home SP2, PB V4.0
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Well right now, if an item is added to a gadget, like a treeview or a listicon/view, that is sorted, the position number is automatically changed when a new item is added.

In order to get the position number of an item, you would need to cycle through all of the nodes/items to find which one is your item and grab the position number. Quite time consuming this way.. Is there another way?

This initially sounded like a great idea, but when the position changes the number initially aquired is outdated.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Bump as a request for after PB 4.0 version.
Post Reply