Listview and SelectionChanged

Discussion in 'Questions (Windows Mobile)' started by magi6162, Sep 3, 2007.

  1. magi6162

    magi6162 Active Member Licensed User

    Hi,
    exists the way to know when it changes the row selected in one treeview?

    magi6162:sign0085:
     
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi,

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

    If you implement a sub
    Code:
    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
     
  3. magi6162

    magi6162 Active Member Licensed User

    thanks!
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I guess you mean ListView ?
     
  5. magi6162

    magi6162 Active Member Licensed User

    yes

    magi6162
     
  6. magi6162

    magi6162 Active Member Licensed User

    the SelectionChanged sub is called twice most of the time.

    exists a workaround?

    magi6162
     
  7. Filippo

    Filippo Expert Licensed User

  8. magi6162

    magi6162 Active Member Licensed User

    Already seen, but it does not explain nothing.

    magi6162
     
  9. specci48

    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
     
  10. dzt

    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.
     
  11. specci48

    specci48 Well-Known Member Licensed User

    Nice workaround. :)
    Programming could be so easy if I wouldn't always think so complicated...
     
  12. magi6162

    magi6162 Active Member Licensed User

    Hi,
    I have resolved using one variable total and verifying if mod 2

    magi6162
     
Loading...