Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10479 > unrolled thread

ListViewItemChanged fires if items is not changed

Started byD.J.W. van Kooten <vankooten@removethis.ic2.com>
First post2017-04-20 11:21 +0200
Last post2017-04-21 13:46 +0200
Articles 4 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  ListViewItemChanged fires if items is not changed D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-04-20 11:21 +0200
    Re: ListViewItemChanged fires if items is not changed "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-20 15:17 +0200
      Re: ListViewItemChanged fires if items is not changed D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-04-21 10:50 +0200
        Re: ListViewItemChanged fires if items is not changed "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-21 13:46 +0200

#10479 — ListViewItemChanged fires if items is not changed

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2017-04-20 11:21 +0200
SubjectListViewItemChanged fires if items is not changed
Message-ID<2ougfcdbp7qdqerosulp1sp0neavltpgo5@4ax.com>
I'm using some Listviews in my program. Now it was my intention to
react upon checking items (only) in a Listview and thought I could do
that via the method ListViewItemChanged.

The help says:


Purpose

Provide a method that is invoked when a list view item has changed.

However, apparently it also fires if listviewitems are just displayed.
I would say that is not what it should do. 

What is the best way to make sure I only get my code running when
someone actually checks an item?

Dick

---
Deze e-mail is gecontroleerd op virussen door AVG.
http://www.avg.com

[toc] | [next] | [standalone]


#10481

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-20 15:17 +0200
Message-ID<elrqs1Fldi9U1@mid.individual.net>
In reply to#10479
Hi Dick,

> However, apparently it also fires if listviewitems are just displayed.
> I would say that is not what it should do.
> What is the best way to make sure I only get my code running when
> someone actually checks an item?

What you can do is to suspend the ListViewItemChanged() code as long the 
window is not visible.


METHOD ListViewItemChanged(oEvent) CLASS  <YourWindow >
LOCAL pNMLV  AS _winNM_LISTVIEW 
LOCAL symListView AS SYMBOL


   SUPER:ListViewItemChanged(oEvent)


    IF SELF:isvisible()  // <-------- 

       ...
       ...


    ENDIF

    RETURN NIL


regards
Karl-Heinz

[toc] | [prev] | [next] | [standalone]


#10482

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2017-04-21 10:50 +0200
Message-ID<kthjfc14ku3e4g0v9il8coifdv79kjv84k@4ax.com>
In reply to#10481
Replying on message of Thu, 20 Apr 2017 15:17:24 +0200 from
Karl-Heinz:


 Hello Karl-Heinz,

>
>    IF SELF:isvisible()  // <-------- 
>

Seems like a good trick, thanks. Still strange that this method is
called almost every time while I'd expect it to be called when
something is acually changed, as the name suggests.

Dick

---
Deze e-mail is gecontroleerd op virussen door AVG.
http://www.avg.com

[toc] | [prev] | [next] | [standalone]


#10483

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-21 13:46 +0200
Message-ID<elu9p5F5jhgU1@mid.individual.net>
In reply to#10482
Hi Dick,

> Seems like a good trick, thanks. Still strange that this method is
> called almost every time while I'd expect it to be called when
> something is acually changed, as the name suggests.

IMO ListViewItemChanged() works correctly.  It´s up to us to ignore any
unwanted state notifications. BTW:  Self:IsVisible() helps not if you add,
after the window is visible, e.g. another Item. In such situations it´s IMO
better to check for the keys a user must press to toggle a item checkbox.


METHOD ListViewItemChanged(oEvent) CLASS <YouWindow>
LOCAL pNMLV  AS _winNM_LISTVIEW
//LOCAL symListView AS SYMBOL

    SUPER:ListViewItemChanged(oEvent)


//    IF SELF:isvisible()

    IF IsKeyPressed ( VK_LBUTTON  ) .OR. IsKeyPressed ( VK_SPACE )   // <---
User action

     ...
     ...

    ENDIF

    RETURN NIL


regards
Karl-Heinz 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web