Re: treeview item events

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi,

----- Original Message -----
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: treeview item events


>
> I came in on the back end of this, you can return any message
> from/to treeview with this.
>
> -- tagNMHDR NMHDR_hwndFrom = 0,
>     NMHDR_idFrom = 4,
>     NMHDR_code = 8,
>     SIZEOF_NMHDR = 12
>
>
> elsif iMsg = WM_NOTIFY then
>
>    id = peek4s(lParam + NMHDR_hwndFrom)
>
>           if id = TreeView then
>
>               iMsg = peek4s(lParam + NMHDR_code)
>
> -- with the returned value "iMsg", any of the NM_* constants
> -- work as well as the TVN_* notification messages...
>
> ofcourse win32lib's way, Im not so sure about.....
> this is how standard API codeing works.

And guess what!?!?!?! Win3Lib uses the very same method - what a
coincidence! Ain't this a small planet, eh.

quote "you can return any message from/to treeview with this..."

Well, actually no you can't. You can only get NOTIFY'ed when the treeview
control sends a message to your program - and there is a fixed set of
messages available - not every message possible in Windows. And here are the
available ones, from the MS Docs...

NM_CLICK (tree view)
Notifies a tree view control's parent window that the user has clicked the
left mouse button within the control.

NM_CUSTOMDRAW (tree view)
Sent by a tree view control to notify its parent window about drawing
operations.

NM_DBLCLK (tree view)
Notifies a tree view control's parent window that the user has
double-clicked the left mouse button within the control.

NM_KILLFOCUS (tree view)
Notifies a tree view control's parent window that the control has lost the
input focus.

NM_RCLICK (tree view)
Notifies a tree view control's parent window that the user has clicked the
right mouse button within the control.

NM_RDBLCLK (tree view)
Notifies a tree view control's parent window that the user has
double-clicked the right mouse button within the control.

NM_RETURN (tree view)
Notifies a tree view control's parent window that the control has the input
focus and that the user has pressed the ENTER key.

NM_SETCURSOR (tree view)
Notifies a tree view control's parent window that the control is setting the
cursor in response to a WM_SETCURSOR message.

NM_SETFOCUS (tree view)
Notifies a tree view control's parent window that the control has received
the input focus.

TVN_BEGINDRAG
Notifies a tree view control's parent window that a drag-and-drop operation
involving the left mouse button is being initiated.

TVN_BEGINLABELEDIT
Notifies a tree view control's parent window about the start of label
editing for an item.

TVN_BEGINRDRAG
Notifies a tree view control's parent window about the initiation of a
drag-and-drop operation involving the right mouse button.

TVN_DELETEITEM
Notifies a tree view control's parent window that an item is being deleted.

TVN_ENDLABELEDIT
Notifies a tree view control's parent window about the end of label editing
for an item.

TVN_GETDISPINFO
Requests that a tree view control's parent window provide information needed
to display or sort an item.

TVN_GETINFOTIP
Sent by a tree view control that has the TVS_INFOTIP style. This
notification is sent when the control is requesting additional text
information to be displayed in a tooltip.

TVN_ITEMEXPANDED
Notifies a tree view control's parent window that a parent item's list of
child items has expanded or collapsed.

TVN_ITEMEXPANDING
Notifies a tree view control's parent window that a parent item's list of
child items is about to expand or collapse.

TVN_KEYDOWN
Notifies a tree view control's parent window that the user pressed a key and
the tree view control has the input focus.

TVN_SELCHANGED
Notifies a tree view control's parent window that the selection has changed
from one item to another.

TVN_SELCHANGING
Notifies a tree view control's parent window that the selection is about to
change from one item to another.

TVN_SETDISPINFO
Notifies a tree view control's parent window that it must update the
information it maintains about an item.

TVN_SINGLEEXPAND
Sent by a tree view control with the TVS_SINGLEEXPAND style when the user
opens or closes a tree item using a single click of the mouse.


And how do you get these messages using Win32lib?

--------------
procedure myNotify(atom iMsg, atom wParam, atom lParam)
    atom lNewMsg
    integer id

    -- Only look at NOTIFY messages
    if iMsg = WM_NOTIFY then
        -- Get which notify message it is.
        lNewMsg = fetch( lParam, NMHDR_code )
        -- Get which control sent it.
        id = getId( fetch(lParam, NMHDR_hwndFrom ) )

        -- Now deal with ...

    end if

end procedure
onEvent[mywin] = routine_id("myNotify")

------------

Not too difficult really. The above code works with all control types and
all message types.

But this doesn't solve the problem. Is it possible to get WM_LBUTTONDOWN
messages or their equivalent? I don't think so. Some deeper coding is
probably needed 'cos the Treeview DLL traps the mouse events prior to your
app getting them.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu