Announcement

Collapse
No announcement yet.

Treeview - NM_CLICK

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

  • Walt Decker
    replied
    That description is also in the winapi help.

    Yes, I could have looked it up on MSDN. Being on dial-up doing so takes forever. I've ordered the latest SDK but it hasn't arrived.

    Thanks for your help and insight.

    Leave a comment:


  • Michael Mattias
    replied
    My SDK doc (which you could have looked up yourself at MSDN)
    action
    Notification-specific action flag.
    Suggests you will be interested in this member based on which notification code you are processing.... in which case the doc for same should be with the doc for that notification code. (the TVN_xxxxx values). (Also available at MSDN).


    MCM

    Leave a comment:


  • Walt Decker
    replied
    Michael:

    Thanks, that helps a heep.

    One more question. In the NM_TREEVIEW structure there is a "action" element. Do you know what that can contain? Is it the same as the NMHDR.code element or different?

    Leave a comment:


  • Michael Mattias
    replied
    Must AND statemask vs State BEFORE testing vs TVIS_xxxx values.

    ie if Statemask AND State AND TVIS_xxx = TVIS THEN it's true.
    If state AND TVIS_xxxx then ... it's only true of Statemask AND TVIS_xxxx is true.

    When retrieving state (TVM_GETITEMSTATE) you will only get valid bits for those bits which on ON in the transmitted statemask. Normally you'd set that mask to &hFFFF because you want all state bits, but that is not a requirement.

    Leave a comment:


  • Walt Decker
    replied
    Michael:

    Just pick up the WM_NOTIFY/TVN_SELCHANGED (or CHANGING) and the WM_NOTIFY/TVN_ITEMEXPANDED (or EXPANDING) notifications.
    That's what I'm doing.


    According to the WinAPI help the state element can be zero or one or more of the TVIS_ constants. If one ANDs the state element with the TVIS_ constants of interest, what good is the statemask? Seems kinda redundant to me.
    Last edited by Walt Decker; 16 Dec 2008, 05:24 PM.

    Leave a comment:


  • Michael Mattias
    replied
    By the way, in the TV_ITEM structure there is a "state" element and a "statemask" element. If you know what the "state" element is, e.g. "TVIS_EXPANDED", why do you have to know which bits, from the "statemask" element, are valid?
    'State' is not an integer, it's a set of BIT flags. You need the statemask to tell which of those bit flags are valid.

    Leave a comment:


  • Walt Decker
    replied
    Michael:

    I'm already doing that. I use two arrays containing the item handles of the root items. I interrogate the NM_TREEVIEW structure for the itemnew element handle then parse through the arrays until I find the element handle then expand/contract both. There probably is another method, but this is the one I'm using.

    By the way, in the TV_ITEM structure there is a "state" element and a "statemask" element. If you know what the "state" element is, e.g. "TVIS_EXPANDED", why do you have to know which bits, from the "statemask" element, are valid?

    Leave a comment:


  • Michael Mattias
    replied
    >It may not be necessary to hook the NM_CLICK message

    If your application is as described... you want to synchronize the selection and expand/collapse status of the two treeview contols.... it is NOT necessary at all.

    Just pick up the WM_NOTIFY/TVN_SELCHANGED (or CHANGING) and the WM_NOTIFY/TVN_ITEMEXPANDED (or EXPANDING) notifications.

    Now... for EXTRA credit... handle both controls with the same code WITHOUT ever interrogating which control actually generated the notification message.

    (Yes, it can be done).

    MCM

    Leave a comment:


  • Walt Decker
    replied
    Paul:

    Thanks. I saw that but I kept thinking, "Sending TVM_EXPAND twice doesn't make sense." Guess there was a small mental block there.

    Dave:

    Thanks for the link. I've been following that thread. It may not be necessary to hook the NM_CLICK message.

    Chris:

    Thanks for the link.

    Leave a comment:


  • Chris Holbrook
    replied
    this link http://www.powerbasic.com/support/pb...ight=walk+tree includes code to suppress the "flashing" of the cursor and also HITTEST code and a link to Steve Rossell's Treeview example which is very useful for many TreeView applications.

    Leave a comment:


  • Paul Squires
    replied
    From the WinAPI help file:

    Code:
    Action flag. This parameter can be one of the following values:
    
    Value	Meaning
    TVE_COLLAPSE	Collapses the list.
    TVE_COLLAPSERESET	Collapses the list and removes the child items. Note that TVE_COLLAPSE must also be specified.
    TVE_EXPAND	Expands the list.
    TVE_TOGGLE	Collapses the list if it is currently expanded or expands it if it is currently collapsed.

    Leave a comment:


  • Walt Decker
    replied
    Stupid Question

    from "commctrl.inc":

    Code:
        FUNCTION TreeView_Expand (BYVAL hWnd AS DWORD, BYVAL hitem AS LONG, _
           BYVAL CODE AS DWORD) AS LONG
            FUNCTION = SendMessage(hWnd, %TVM_EXPAND, CODE, hitem)
        END FUNCTION
    What is "CODE"?

    Leave a comment:


  • Walt Decker
    replied
    Perhaps I should explain what I'm trying to do.

    I have two treeviews. Each has the same number of root nodes with the same text, but they may have a different number of children items with different text. I want to enable one-click expansion and contraction of both treeview root nodes when a user clicks on either control. The synchronization of the treeviews is no problem but the one-click aspect is.

    Another aspect is suppressing the highlight when the user selects either a root node or child item. I have not found a way to do that.

    Leave a comment:


  • Dave Biggs
    replied
    See this post for another way to determine which item has been clicked.
    http://www.powerbasic.com/support/pb...637#post304637

    Leave a comment:


  • Paul Squires
    replied
    Try the following:

    Code:
    Local pNMTV  As NM_TREEVIEW Ptr
    
    pNMTV = lParam
    
    hNode = @pNMTV.itemNew.hItem

    Leave a comment:


  • Walt Decker
    started a topic Treeview - NM_CLICK

    Treeview - NM_CLICK

    Is there any way to determine which node the user has clicked on via the NM_CLICK message or does that have to be determined via the TVN_SELCHANGING message and the NM_TREEVIEW structure?
Working...
X