Thanks Chris,
Unfortunately, the first thread doesn't have a method to set the CheckBox
state. It uses ListView>>lvmGetItemState:mask:
I have used the equivalent set method though: ListView>>lvmSetItem:state: ,
which calls the ListView>>sendMessage method.
I've got the code to work in Workspace now. I think I had the wrong
parameters for the LVITEM. Here it is:
LVM_FIRST := 16r1000.
LVM_SETITEMSTATE := LVM_FIRST + 43.
LVIS_STATEIMAGEMASK := 16rF000.
LVIF_STATE := 16r8.
lv := ListView show.
lv isVirtual: false.
lv hasCheckBoxes: true.
lv model list: #(1 2 3 4).
lvItem := LVITEM new.
lvItem
mask: LVIF_STATE;
state: 16r2000; "true"
stateMask: LVIS_STATEIMAGEMASK.
itemIndex := 1. "zero based - so should check the 2nd box"
lv view lvmSetItem: itemIndex state: lvItem
The code is based on this VB artice I found, which might help others with
the same question:
http://vbnet.mvps.org/index.html?code/comctl/lvcheckboxgetset.htmRegards,
Don