1. RE: Disabling Mouse-Clicks on a TreeView
- Posted by Cuvier Christian <christian.cuvier at insee.fr> Sep 12, 2006
- 573 views
Just replace the test on className by
if not match("edit",lower(className)) then ...
This will work until you find a custom control which is an edit text control, but wasn't named correctly, or a control which is not about editing text but has that "edit" string in the class name. Both are highly unlikely, and may happen only if you subclass controls from apps you didn't author the class they use. HTH CChris ------------------------ Subject: Disabling Mouse-Clicks on a TreeView Hi, Is there a way to disable mouse-clicks on a TreeView control? I am using following logic for all the controls which works fine except TreeView:
--#========================================================================= = --#Enable / Disable a control and it's children. --#========================================================================= = procedure readonlyCtl (integer self, integer event, sequence params) returnValue(w32True) end procedure function setCtlAccess(integer CtlId, integer avail_mode) sequence children, className className = getClassName(CtlId) if find(className, {"ComboBox", "ComboLBox", "ComboBoxEx32", "Button", "SysListView32", "SysTreeView32"}) then if avail_mode then removeHandler(CtlId, {w32HMouse, w32HKeyDown, w32HKeyUp, w32HClick}, routine_id("readonlyCtl")) addStyle(CtlId, WS_TABSTOP) else setHandler(CtlId, {w32HMouse, w32HKeyDown, w32HKeyUp, w32HClick}, routine_id("readonlyCtl")) removeStyle(CtlId, WS_TABSTOP) end if else setReadOnly(CtlId, iff(avail_mode, w32False, w32True)) end if children = getChildren(CtlId) for i = 1 to length(children[1]) do void = setCtlAccess(children[1][i], avail_mode) end for return w32True end function #==========================================================================
In case of TreeView, I can still click and navigate it. Regards, Rad. ------------------------------ End of EUforum at topica.com digest, issue 6099
2. RE: Disabling Mouse-Clicks on a TreeView
- Posted by Rad <radhx at rediffmail.com> Sep 14, 2006
- 528 views
> Just replace the test on className by > }}} <eucode> > if not match("edit",lower(className)) then ... > </eucode> {{{ Thanks Cuvier. I tried it out, but the question regarding TreeView remains. I can still click on TreeView Item or scroll the TreeView. (Though the Up/Down keys get disabled properly) Any suggestions for handling mouse-clicks on TreeView? Regards, Rad.
3. RE: Disabling Mouse-Clicks on a TreeView
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 14, 2006
- 517 views
You need to trap WM_NOTIFY messages for the control and look for NM_CLICK NM_DBLCLICK NM_RCLICK notifications. If you return a non-zero to the WM_NOTIFY message then Windows will ignore the mouse event. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
4. RE: Disabling Mouse-Clicks on a TreeView
- Posted by Rad <radhx at rediffmail.com> Sep 19, 2006
- 539 views
Derek Parnell wrote: > > You need to trap WM_NOTIFY messages for the control and look for > > NM_CLICK > NM_DBLCLICK > NM_RCLICK > > notifications. If you return a non-zero to the WM_NOTIFY message then Windows > will ignore the mouse event. > I tried to trap WM_NOTIFY messages as suggested by using following code:
procedure TreeView180_onEvent (integer self, integer event, sequence params)--params is ( int iMsg, atom wParm, atom lParm ) atom Memset, NmHdr if params[1] = WM_NOTIFY then setText(MaintStatBar, "WM_NOTIFY....") Memset = w32new_memset() NmHdr = w32acquire_mem(Memset, SIZEOF_NMHDR) poke(NmHdr, peek({params[3], SIZEOF_NMHDR})) if w32fetch(NmHdr, NMHDR_code) = NM_CLICK then setText(MaintStatBar, "WM_NOTIFY (Left Click)") end if if w32fetch(NmHdr, NMHDR_code) = NM_DBLCLK then setText(MaintStatBar, "WM_NOTIFY (Double Click)") end if if w32fetch(NmHdr, NMHDR_code) = NM_RCLICK then setText(MaintStatBar, "WM_NOTIFY (Right Click)") end if if w32fetch(NmHdr, NMHDR_code) = NM_RDBLCLK then setText(MaintStatBar, "WM_NOTIFY (Right Double Click)") end if if find(w32fetch(NmHdr, NMHDR_code), {NM_CLICK, NM_DBLCLK, NM_RCLICK, NM_RDBLCLK}) then w32release_mem(Memset) returnValue(w32True) end if w32release_mem(Memset) end if end procedure setHandler( TreeView180, w32HEvent, routine_id("TreeView180_onEvent"))
Though I get the first "WM_NOTIFY...." text on the status bar, none of the other click-specific text gets displayed on the status bar, hence no effect of returnValue. How to validate NMHDR_code value? Am I doing anything wrong in above code? Regards, Rad.