1. treeview item events
- Posted by wick900 at operamail.com Aug 10, 2001
- 539 views
I was looking in the archives for information on treeviews, but most of it didn't make sense. I want to figure out how to trigger an event when an treeview item gets a onMouse() event (or an equivalent). Is this possible?
2. Re: treeview item events
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 11, 2001
- 532 views
There doesn't seem to be a way to trap mouse events (other than clicks) in a treeview. I guess the control intercepts mouse messages before your prgram gets to see them. ----- Original Message ----- From: <wick900 at operamail.com> To: "EUforum" <EUforum at topica.com> Subject: treeview item events > > I was looking in the archives for information on treeviews, but most of > it didn't make sense. I want to figure out how to trigger an event when > an treeview item gets a onMouse() event (or an equivalent). Is this > possible? > > > > > >
3. Re: treeview item events
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 11, 2001
- 555 views
Yeah I thought of this, plus there is a "hover" event that can be tracked. However, you can't see mouse down/up/move events and I assume this is what is being asked for. You can see click, double-click, right-click, right-double-click, hover, drag-start, drag-end and tooltip note. ----- Original Message ----- From: "Bernie Ryan" <xotron at localnet.com> To: "EUforum" <EUforum at topica.com> Subject: RE: treeview item events > > > Derek Parnell wrote: > > There doesn't seem to be a way to trap mouse events (other than clicks) > > in a > > treeview. I guess the control intercepts mouse messages before your > > prgram > > gets to see them. > > > > Derek: > > Why couldn't you intecept the tooltips notification > message this would be triggered any time the mouse was over the > item. > > Bernie > > > > >
4. Re: treeview item events
- Posted by euman at bellsouth.net Aug 11, 2001
- 533 views
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. Euman euman at bellsouth.net From: "Derek Parnell" <ddparnell at bigpond.com> > There doesn't seem to be a way to trap mouse events (other than clicks) in a > treeview. I guess the control intercepts mouse messages before your prgram > gets to see them. > > From: <wick900 at operamail.com> > > I was looking in the archives for information on treeviews, but most of > > it didn't make sense. I want to figure out how to trigger an event when > > an treeview item gets a onMouse() event (or an equivalent). Is this > > possible?
5. Re: treeview item events
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 12, 2001
- 592 views
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.
6. Re: treeview item events
- Posted by euman at bellsouth.net Aug 12, 2001
- 534 views
> ORIGINAL QUESTION: > I was looking in the archives for information on treeviews, but most of > it didn't make sense. I want to figure out how to trigger an event when > an treeview item gets a onMouse() event (or an equivalent). > Is this possible? I have no problems manipulating treeviews, maybe win32lib isnt up to the challenge... onMouse - Win32lib onEvent - Win32lib onClick - Win32lib WM_LBUTTONDOWN - API WM_RBUTTONDOWN - API WM_MOUSEMOVE - API WM_LBUTTONUP - API WM_RBUTTONUP - API and a few others, but because Im not a smart ass I wont include them as Derek provided us with half the damn SDK last message. I have a copy, thanks anyway Derek! therefore, onMouse = WM_LBUTTONDOWN but because of the notification message built into Treeview API, NM_CLICK must be the answer, eh! oh but wait, what about a mouse moveing over our treeview NMMOUSE and the point (pt) portion of the struct comes to mind here.. We wont go there unless Derek conceeds Win32lib cant do what API can... You see, Event driven libraries are in-efficient in speed, size and ability. Back to the ORIGINAL QUESTION: elsif iMsg = WM_NOTIFY then id = peek4s(lParam + NMHDR_hwndFrom) elsif id = TreeView then iMsg = peek4s(lParam + NMHDR_code) if iMsg = NM_CLICK then --Mouse click happened ontop of our treeview -- DO SOMETHING................ Well, Derek your wrong about sending messages to treeview. Are you saying that someone cant -on the fly- change charcteristics for a treeview?!?!?!? by sending a message to the controls parent. I think if you do this Derek that the treeview will respond which must mean that the treeview got a message hence my term to/from in the prior post. Derek, I think it's great that you try so hard to defend win32lib..... But most of us know the truth! BLOAT, "find your way around that freakin maze." SLOW, "try running an app on a 486, grab a cup of coffee and wait!" LIMITED, "to the imagination of the creator/s." EXTENDABILITY, "not for everyone, better off learning API." BUG CITY, "too many to mention." ETC..., ETC... Euman euman at bellsouth.net