ListView question

legion48

Member
Licensed User
Longtime User
I have a series of ListViews that, when selected, populate Label1 with a relevant text string.

Is there any way to advance the ListView position by +1 or -1, and in doing so, updating Label1 by a Click event on label1?

Can you even call the ListView1_ItemClick from Label1_ItemClick? This is the error I get when I attempt it:



"Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'position' is used before it was assigned any value.
Occurred on line: 758
ListView1_ItemClick (Position As Int, Value As Object)"
 

stevel05

Expert
Licensed User
Longtime User
The _ItemClick method for a ListView is a 'listener' i.e. it reacts to user interaction with the list. When you click an item the method is called and the parameters Position As Int & Value As Object are provided so you know whats been selected.

You can set the current selection using SetSelection so it should be possible to maintain a global variable to hold the current selection, updated in ListView_ItemClick, and increment/decrement through code.

Take a look at the documentation, there is no automatic highlight, it just makes the selected item visible.

Hope this helps.
 
Upvote 0
Top