The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two Questions for QMGRID cell color paint
#1
Hello ~ Gintaras ~!!!

I tried to paint cells on qmgrid but I couldn't although I tried examples as much as I could.

I have 2 questions.


1. In below code, How could I change font color and background color according to row items? (ex all txt to white, rabbit background to red, tiger to blue, horse to green)

 
Code:
Copy      Help
 
Function [b]Function4[/b] [help1][/help1]
[code]\Dialog_Editor

LoadQmGrid

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 300 314 "Dialog" "4"
;3 QM_Grid 0x56031041 0x200 12 12 276 242 "0[]A[]B"
;1 Button 0x54030001 0x4 172 288 48 14 "OK"
;2 Button 0x54030000 0x4 240 288 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3"
str qmg3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

DlgGrid RN.Init(hDlg 3)
ICsv ADATA._create;ADATA.Separator=","

sel message
,case WM_INITDIALOG goto gInit
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

;gInit
str CSV =
;rabbit,10
;tiger,20
;horse,30
;rabbit,40
ADATA.FromString(CSV)
RN.FromICsv(ADATA)
ret
[/code]



2. I found example which you wrote how to change cell colors when checked, but cell colors were changed when mouseover other cells without check its row's checkbox
till check another checkbox. How could I fix to change row color just when check checkbox of it's row ?

http://www.quickmacros.com/forum/showthr...light=grid
Code:
Copy      Help
Function [b]Function5[/b] [help1][/help1]
[code]\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)
[/code]

Thank you always !!


Messages In This Thread
Two Questions for QMGRID cell color paint - by luvu2des - 08-16-2019, 03:47 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)