Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grid control(QM_Grid) with icon in another column than first
#1
I wonder whether it is possible to have a Grid control (QM_Grid) with an icon in the rows of another column, than the first one.
Many thanks in advance
#2
Code:
Copy      Help
function hlv row column imageIndex

LVITEMW lvi.mask=LVIF_IMAGE
lvi.iItem=row
lvi.iSubItem=column
lvi.iImage=imageIndex
SendMessage(hlv LVM_SETITEMW 0 &lvi)
#3
Thank you! Have a nice weekend!
#4
I did not test it, possibly does not work with QM_Grid. This code is for a non-virtual listview.
#5
Thank you for this explanation. I will test it in a while and I will let you know. By the way I have seen somewhere else, very likely in a topic of QM-Forum by you, that it is the LVITEMW technique that may be used in such cases.
#6
This is for QM_Grid and other virtual listview controls. Need to set image in LVN_GETDISPINFO.

Function grid_subitem_images
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80A48 0x100 0 0 281 159 "QM_Grid"
;3 QM_Grid 0x56031041 0x200 0 0 206 134 "0x16,0,0,0x0,0x0[]A,50%,,[]B,20%,,[]C,20%,,"
;1 Button 0x54030001 0x4 2 142 48 14 "OK"
;2 Button 0x54030000 0x4 52 142 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

str controls = "3"
str qmg3x

;Set data for the grid control.
qmg3x=
;<//2>row 0,q,z
;<//4>row 1,w,x

if(!ShowDialog(dd &sub.DlgProc &controls _hwndqm)) ret


#sub DlgProc
function# hDlg message wParam lParam

DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,;set imagelist for the grid control
,__ImageList- il.Load("$qm$\il_dlg.bmp")
,g.SetImagelist(il il)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
ret 1

;Shows how to set images for non-first-column cells.

;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,sel nh.code
,,case LVN_GETDISPINFOW
,,NMLVDISPINFOW& di=+nh
,,LVITEMW& u=di.item
,,;out F"{u.iItem} {u.iSubItem}"
,,if u.iSubItem
,,,u.mask|LVIF_IMAGE
,,,u.iImage=6
#7
Yes ! The later works perfectly !!!
#8
I have experienced that :

(1) If you do not need at all icons in column 0, then you have to change:
Quote:qmg3x=
<//-1>row 0,q,z
<//-1>row 1,w,x

(2) If you need icons only in column 2, then you have to change to :
Quote: if u.iSubItem=2 ;; Select column to show icon here
u.mask|LVIF_IMAGE
u.iImage=col2[u.iItem]

I would appreciate it if you could kindly confirm or advise respectively.
#9
In the case of a grid with icons in two (or more) of its columns, I wonder whether it is possible to get the icons data (g.SetImagelist) from two different imagelist files, one for each column. Thanks for your advice, in advance.
#10
Now answered in topic :

Obtain Image list data from separate bmp files for each colu


Forum Jump:


Users browsing this thread: 1 Guest(s)