Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions regarding the last row enterd in a QM-Grid
#1
1. A QM-Grid is initiated using :
Quote:g.GridStyleSet(1|8)
I am filling a cell in this grid,, for example in column-3. The first column is associated with an icon depending on the text in column-3. My question :
Is it possible, after ending with column-3, to come back to display the icon in Column-0, in other words, is it possible to invoke a LVN_GETDISPINFOW message.

2. Is it possible to retrieve the last row entered in a QM-Grid?

Thank you for both.
#2
In my test code LVN_GETDISPINFOW for whole row is received after changing text of any cell. If it isn't, maybe depends on Windows version.

Function test_QM_grid_LVN_GETDISPINFOW_after_changing_cell_text
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 "0x9,0,0,0x0,0x0[]A[]B[]image index"
;4 Button 0x54032000 0x0 216 8 48 22 "Change image index"
;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=
;row 0,q,2
;row 1,w,6

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 4 ;;Change image index
,g.CellSet(0 2 val(g.CellGet(0 2))+1)
ret 1

;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=0
,,,u.mask|LVIF_IMAGE
,,,u.iImage=val(g.CellGet(u.iItem 2))

2. Let your code remember it when it receives LVN_QG_CHANGE or LVN_ENDLABELEDIT or some other message. Look in macro "sample_Grid" in System folder.
#3
It is very clear. Many thanks indeed !


Forum Jump:


Users browsing this thread: 1 Guest(s)