03-31-2016, 04:16 AM
Hi Gintaras,
I am now trying to do this as you suggested with checkboxes. I would still like for the checkbox selection to cause the row to change background color. I tried using SendMessage LVM_SETBKCOLOR but it only changes the background of the checkbox instead of the entire row. So instead I used NM_CUSTOMDRAW as you suggested in http://www.quickmacros.com/forum/showthr...p?tid=2941
It works for coloring or uncoloring the background of all row cells but it paints all the rows you move over if you move the mouse too fast.
Any ideas how to implement NM_CUSTOMDRAW better?
Also, I would like to have multi-line text in a cell where all the text is visible (not just on hover over).
Like this:
Also is it possible to put in text button or icon/bmp button in the grid cell like this:
Thanks so much,
S
Function BackgroundColorCheckedRowDlg
I am now trying to do this as you suggested with checkboxes. I would still like for the checkbox selection to cause the row to change background color. I tried using SendMessage LVM_SETBKCOLOR but it only changes the background of the checkbox instead of the entire row. So instead I used NM_CUSTOMDRAW as you suggested in http://www.quickmacros.com/forum/showthr...p?tid=2941
It works for coloring or uncoloring the background of all row cells but it paints all the rows you move over if you move the mouse too fast.
Any ideas how to implement NM_CUSTOMDRAW better?
Also, I would like to have multi-line text in a cell where all the text is visible (not just on hover over).
Like this:
Also is it possible to put in text button or icon/bmp button in the grid cell like this:
Thanks so much,
S
Function BackgroundColorCheckedRowDlg
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 133 "Dialog"
;3 QM_Grid 0x56031041 0x200 2 0 218 110 "0x33,0,0,0,0x80[]#,,7,[]Name,,7,"
;5 Button 0x54032000 0x0 4 114 100 16 "Get Checked"
;1 Button 0x54030001 0x4 116 114 48 14 "OK"
;2 Button 0x54030000 0x4 170 114 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "" "" ""
str controls = "3"
str qmg3x
if(!ShowDialog("BackgroundColorCheckedRowDlg" &BackgroundColorCheckedRowDlg &controls)) ret
ret
;messages
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,_s=
,;1,A
,;2,B
,;3,C
,;4,D
,;5,E
,;6,F
,;7,G
,;8,H
,g.FromCsv(_s ",")
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 5 ;;Get Checked
,,ARRAY(int) arrintGetCheckedRows.redim
,,int TotRows = g.RowsCountGet
,,int TotCheckedRows = 0
,,for _i 0 TotRows
,,,if(g.RowIsChecked(_i))
,,,,arrintGetCheckedRows[] = _i
,,,,TotCheckedRows = TotCheckedRows + 1
,,out "Total Checked Rows = %i:" TotCheckedRows
,,for _i 0 arrintGetCheckedRows.len
,,,out arrintGetCheckedRows[_i]
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,GRID.QM_NMLVDATA* cd=+nh
,NMLVDISPINFO* di=+nh
,NMLISTVIEW* nlv=+nh
,NMITEMACTIVATE* na=+nh
,NMLVCUSTOMDRAW* cd1=+nh
,int- CheckedRowBit
,sel nh.code
,,;These notifications are from QM_Grid.
,,;All text coming from QM_Grid is in QM format (UTF-8 or ANSI, depending on QM Unicode mode).
,,case [NM_CLICK,NM_DBLCLK,NM_RCLICK] ;;when user clicks a row or empty space, and it does not begin cell edit mode
,,,out "row click: %i %i" na.iItem na.iSubItem
,,case LVN_ITEMCHANGED
,,,int row isChecked
,,,if(g.RowIsCheckNotification(lParam row isChecked)) out "%schecked %i" iif(isChecked "" "un") row
,,,,if(isChecked)
,,,,,CheckedRowBit = 1
,,,,else
,,,,,CheckedRowBit = 0
,,case NM_CUSTOMDRAW
,,,sel cd1.nmcd.dwDrawStage
,,,,case CDDS_PREPAINT ret DT_Ret(hDlg CDRF_NOTIFYITEMDRAW)
,,,,case CDDS_ITEMPREPAINT
,,,,,if(CheckedRowBit)
,,,,,,cd1.clrTextBk = 0xe0ff
,,,,,,g.RowSelect(-1)
,,,,,else
,,,,,,cd1.clrTextBk = 0xFFFFFF
,,,,,,g.RowSelect(-1)