MCPcopy Index your code
hub / github.com/lxn/walk / SetCheckBoxes

Method SetCheckBoxes

tableview.go:959–991  ·  view source on GitHub ↗

SetCheckBoxes sets if the *TableView has check boxes.

(checkBoxes bool)

Source from the content-addressed store, hash-verified

957
958// SetCheckBoxes sets if the *TableView has check boxes.
959func (tv *TableView) SetCheckBoxes(checkBoxes bool) {
960 var hwnd, hwndOther win.HWND
961 if tv.hasFrozenColumn {
962 hwnd, hwndOther = tv.hwndFrozenLV, tv.hwndNormalLV
963 } else {
964 hwnd, hwndOther = tv.hwndNormalLV, tv.hwndFrozenLV
965 }
966
967 exStyle := win.SendMessage(hwnd, win.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
968 oldStyle := exStyle
969 if checkBoxes {
970 exStyle |= win.LVS_EX_CHECKBOXES
971 } else {
972 exStyle &^= win.LVS_EX_CHECKBOXES
973 }
974 if exStyle != oldStyle {
975 win.SendMessage(hwnd, win.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, exStyle)
976 }
977
978 win.SendMessage(hwndOther, win.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, exStyle&^win.LVS_EX_CHECKBOXES)
979
980 mask := win.SendMessage(hwnd, win.LVM_GETCALLBACKMASK, 0, 0)
981
982 if checkBoxes {
983 mask |= win.LVIS_STATEIMAGEMASK
984 } else {
985 mask &^= win.LVIS_STATEIMAGEMASK
986 }
987
988 if win.FALSE == win.SendMessage(hwnd, win.LVM_SETCALLBACKMASK, mask, 0) {
989 newError("SendMessage(LVM_SETCALLBACKMASK)")
990 }
991}
992
993func (tv *TableView) fromLVColIdx(frozen bool, index int32) int {
994 var idx int32

Callers 3

CreateMethod · 0.95
SetFrozenMethod · 0.80
sendMessageMethod · 0.80

Calls 2

newErrorFunction · 0.85
SendMessageMethod · 0.65

Tested by

no test coverage detected