Listview and SelectionChanged

magi6162

Well-Known Member
Licensed User
Hi,
exists the way to know when it changes the row selected in one treeview?

magi6162:sign0085:
 

specci48

Well-Known Member
Licensed User
Hi,

as far as I know: Yes and no...

If you implement a sub
B4X:
Sub listView_SelectionChanged
    ...
End Sub
this sub is called, when a different cell is selected (or a different row on FullRowSelect).
BUT this event is not documented yet, because it is a little buggy. After selecting a different cell or row, the SelectionChanged sub is called twice most of the time. If this doesn't matter in your application, I think you can use it.

@ Filippo
If you read this thread, please check why the SelectionChanged event behaves buggy like this. Maybe you can fix it!


specci48
 

magi6162

Well-Known Member
Licensed User
the SelectionChanged sub is called twice most of the time.

exists a workaround?

magi6162
 

specci48

Well-Known Member
Licensed User
Hello magi6162,

as the SelectionChanged event is not always called twice, even a separate counter wouldn't solve this problem. So I think the only way is to fix the bug in the dll... :(


@Filippo again: Please read this thread carefully and post a small answer if you can/can't/will/won't fix this bug in your dll. As an alternative you can post your actual source code (which includes your last additions) so someone else could be so cute to fix the bug. Thanks!


specci48
 

dzt

Active Member
Licensed User
Hi,

I didn't test the ListView but... listen to my thoughts.

Why don't you keep the selected row number in a global B4PPC variable and every time the event SelectionChanged fires, check if the selected row is the same as the previous selected row.

If it is, then this should be the second (false) event. So ignore it.
 

specci48

Well-Known Member
Licensed User
Nice workaround. :)
Programming could be so easy if I wouldn't always think so complicated...
 
Top