Announcement

Collapse
No announcement yet.

Lvn_setdispinfo

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lvn_setdispinfo

    Does anyone use this? Nothing in the fora.

    It does not seem to be generated when items are added to or edited in an list view with the LVS_OWNERDRAW property. The same listview sends LVN_GETDISPINFO messages.

  • #2
    Ms

    " Nothing in the fora"????

    Search on LVN_GETDISPINFO here, you will get a plethora of hits. Or search POFFS. You should get over 50 hits.

    http://www.powerbasic.com/support/fo...ML/001207.html
    ' The %LVS_OWNERDATA style means that ListView will request
    ' items when needed through %LVN_GETDISPINFO message.
    ... then in the WM_NOTIFY case code ...
    Code:
    CASE %LVN_GETDISPINFO    'Virtual ListView ask for Item text
                                lpLVDispInfo = CBLPARAM
                                IF (@lpLVDispInfo.item.mask AND %LVIF_TEXT) THEN
                                    ' Specify text to be used
                                    IF @lpLVDispInfo.item.iSubItem = 0 THEN ' row header
                                        szString = DataArray(0 , @lpLVDispInfo.item.iItem + 1)
                                    ELSE                                    ' column 1 and beyond
                                        szString = DataArray(@lpLVDispInfo.item.iSubItem + siX.nPos - 1 , @lpLVDispInfo.item.iItem + 1)
                                    END IF
                                    @lpLVDispInfo.item.pszText = VARPTR(szString)
                                    FUNCTION = 1: EXIT FUNCTION
    Rick Angell

    Comment


    • #3
      LVN_SETDISPINFO I never used, but looking at the description...
      Notifies a list-view control's parent window that it must update the information it maintains for an item. This notification message is sent in the form of a WM_NOTIFY message.
      ... I can't see that it would be terribly useful except with a virtual listview (LVS_OWNERDATA)...
      virtual list-view control maintains very little item information itself. Except for the item selection and focus information, the owner of the control must manage all item information.
      .. and for some reason you are choosing to maintain the display info in detail in program variables rather than getting it when needed on LVN_GETDISPINFO.

      But to be honest I'm not sure what info other than focus and selection state would be useful... but those are maintained by the control anyway and you can always get them when needed with the LVM_GETITEM message or Listview_getItem macro.

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Originally posted by Michael Mattias View Post
        .. and for some reason you are choosing to maintain the display info in detail in program variables rather than getting it when needed on LVN_GETDISPINFO.
        That's right, I have an unpredicatable number of editable listviews which reflect the contents of dynamic arrays. I thought that when the listview item is edited it would have the decency to report the new value to the listview owner. As it is I use a WM_USER+ message to the same end.

        Comment


        • #5
          I never considered editing... that sounds like a good application.

          It does not send that notification?

          Maybe you need to be using LPSTR_TEXTCALLBACK for LV_ITEM.pszText and/or LVS_OWNERDRAW or LVS_OWNERDATA styles to get it?
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            FOUND IT!

            LVM_SETCALLBACKMASK Message
            ....
            Changes the callback mask for a list-view control. You can send this message explicitly or by using the ListView_SetCallbackMask macro.
            ....
            The callback mask is zero by default, meaning that the list-view control stores all item state information
            ....
            .....

            If the list-view control detects a change in an item's callback information, such as a change in the text, icon, or state information, the control sends an LVN_SETDISPINFO notification message to notify you of the change.
            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              That looks promising MCM, will try it and advise.

              Comment


              • #8
                Originally posted by Richard Angell View Post
                " Nothing in the fora"????
                Search on LVN_GETDISPINFO here, you will get a plethora of hits.

                Absolutely. And I use it all the time. Read the title of my post again.

                Comment


                • #9
                  Originally posted by Michael Mattias View Post
                  FOUND IT!
                  doesn't work for me - this code:
                  Code:
                      lresult = sendmessage( hCtl, %LVM_SETCALLBACKMASK, %LVIS_CUT OR %LVIS_DROPHILITED OR %LVIS_FOCUSED OR %LVIS_SELECTED , 0)
                      DIALOG SET TEXT getparent(getparent(hCTl)), "setmask=" + STR$(lresult): SLEEP 1000
                  in the LV initialisation function did not result in LVN_SETDISPINFO messages getting sent after new data was added or old data edited in the list view control.

                  I have a workaround, sending a user message from the edit function back to the listview owner, so although a more generic solution would have been nice it is not essential. I will leave the "correct solution" for the next time.

                  Comment


                  • #10
                    What status changes do you want to detect?

                    If the text....
                    I don't understand "sending a user message from the edit function back to the listview owner" ... When you edit a listview item you get WM_NOTIFY/ LVN_ENDLABELEDIT notification in the owner window, where you can either accept or reject the edit. Why can't you do your update there? (It's what I do).

                    As far as selected/focused state, when they change or about to change you get WM_NOTIFY/LVN_STATECHANGING/STATECHANGED notifications (one for each) in owner.

                    (Insufficient code shown)


                    I know I used that callback thing once a long time ago but darned if I remember for what or why, since the above notifications serve all my needs.


                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Originally posted by Michael Mattias View Post
                      When you edit a listview item you get WM_NOTIFY/ LVN_ENDLABELEDIT notification in the owner window
                      Oh. Not using LVM_GETEDITCONTROL etc. I seem to have evolved another method. Code developed from that shown in http://www.powerbasic.com/support/pb...ad.php?t=38565.

                      Comment


                      • #12
                        > seem to have evolved another method

                        Gee, call me a stickler for detail but your original post has nada to with handling LVM_ messages or LVN_ notifications because YOU ARE NOT USING THE LISTVIEW CONTROL TO HANDLE THE EDITING WHICH IS WHAT YOU WERE ASKING ABOUT.

                        <vulgarity>, this is even worse than "code not shown!"
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Originally posted by Michael Mattias View Post
                          YOU ARE NOT USING THE LISTVIEW CONTROL TO HANDLE THE EDITING WHICH IS WHAT YOU WERE ASKING ABOUT.
                          Well, maybe you assume too <vulgarity> much. But your suggestions are none the less welcome.

                          Comment

                          Working...
                          X