1. win32lib: ListView with checkboxes
How does one enable disable checkboxes in a ListView column?
Regards,
Rad.
2. Re: win32lib: ListView with checkboxes
flags = or_all({LVS_EX_CHECKBOXES})
VOID = sendMessage( ListView, LVM_SETEXTENDEDLISTVIEWSTYLE, flags, flags)
allen
3. Re: win32lib: ListView with checkboxes
Allen Ashby wrote:
>
> flags = or_all({LVS_EX_CHECKBOXES})
> VOID = sendMessage( ListView, LVM_SETEXTENDEDLISTVIEWSTYLE, flags, flags)
>
> allen
I am able to get the checkboxes in Listview using LVS_EX_CHECKBOXES.
What I want to do is once the checkboxes are in place, conditionally enable
or disable them. As we can use setCheck() to mark the checkboxes, is there
any way to only checkbox column to be enabled or disabled?
setEnable() enables/disables entire listview where one can not scroll in
disabled mode.
Rad.
4. Re: win32lib: ListView with checkboxes
- Posted by George Walters <gwalters at sc.rr.com>
Jan 13, 2006
-
Last edited Jan 14, 2006
I would like to know the answer to this also.
5. Re: win32lib: ListView with checkboxes
Rad wrote:
>
> Allen Ashby wrote:
> >
> > flags = or_all({LVS_EX_CHECKBOXES})
> > VOID = sendMessage( ListView, LVM_SETEXTENDEDLISTVIEWSTYLE, flags, flags)
> >
> > allen
>
> I am able to get the checkboxes in Listview using LVS_EX_CHECKBOXES.
>
> What I want to do is once the checkboxes are in place, conditionally enable
> or disable them. As we can use setCheck() to mark the checkboxes, is there
> any way to only checkbox column to be enabled or disabled?
>
> setEnable() enables/disables entire listview where one can not scroll in
> disabled mode.
>
> Rad.
Can anybody help me on this? Is there a way to make a ListView / TreeView
ReadOnly and scrollable at the same time?
Regards,
Rad.
6. Re: win32lib: ListView with checkboxes
Rad wrote:
> > What I want to do is once the checkboxes are in place, conditionally enable
> > or disable them. As we can use setCheck() to mark the checkboxes, is there
> > any way to only checkbox column to be enabled or disabled?
> >
> Can anybody help me on this? Is there a way to make a ListView / TreeView
> ReadOnly and scrollable at the same time?
Rad,
I would suggest that when you want the control to have check boxes but not allow
the user to check/un-check, I would remove the check boxes extended style and use
simple bitmap/icon/etc. to "emulate" check boxes. In other words, if the item
was checked before then use a graphic that looks "like" a checked box.
Jonas Temple
http://www.yhti.net/~jktemple
7. Re: win32lib: ListView with checkboxes
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
8. Re: win32lib: ListView with checkboxes
Thanks Larry, Jonas.
The following code worked well for ListView.
procedure readonlyLVTV (integer self, integer event, sequence params)--params is
()
returnValue(w32True)
end procedure
global procedure setLVTV(integer CtlId, integer CtlMode) -- CtlMode = 0:ReadOnly
1:Editable
sequence Lists, className
Lists = {"SysListView32", "SysTreeView32"}
className = getClassName(CtlId)
if find(className, Lists) then
setEnable(CtlId, w32True)
if CtlMode then
removeHandler(CtlId, w32HMouse, routine_id("readonlyLVTV"))
addStyle(CtlId, WS_TABSTOP)
else
setHandler(CtlId, w32HMouse, routine_id("readonlyLVTV"))
removeStyle(CtlId, WS_TABSTOP)
end if
else
setEnable(CtlId, CtlMode)
end if
end procedure
But looks like it does not have any effect on a TreeView, as TreeView is
still accessible after setting the handler.
Regards,
Rad.