Re: win32lib: ListView with checkboxes
- Posted by Larry Miller <larrymiller at sasktel.net> Jan 17, 2006
- 474 views
There is no window style that will disable a Listview or Treeview that will not also disable scrolling. But the effect can be simulated quite easily. The key is in preventing the control from receiving the mouse button messages. Insert code like this in the event handler for the control:
if id=listview and event=w32HMouse then returnValue(w32True) end if
id is the first parameter in the event handler and refers to the id of the control in question. To prevent selection of the control with the keyboard you will have to remove the WS_TABSTOP style like this: removeStyle(listview, WS_TABSTOP) This will prevent the client area of the listview from receiving any mouse messages, thus preventing all selections. This has no effect on non-client areas of the listview so scroling or use of the listview header will not be effected. It is also possible to disable specific listview items but this requires more complicated low level event handling. A similar method should work with Treeviews. Let me know if you require any further assistance. Larry Miller