Posts: 1,000
Threads: 253
Joined: Feb 2008
How can a change be made to another cell in a QM grid based on data changing?
I understand that a function like gridNotify would be where the data would be received and updated, but how do you send data to a specific cell?
Also, is there anyway a the OpenSaveDialog could make multiple selections and populate a column in the grid?
And, how do you load a completely blank grid where the boxes remain editable. It seems like if I load an empty grid all of the cells lose there ability to be edited.
Any chances of using a DatePicker?
Thanks,
Jimmy Vig
Posts: 12,073
Threads: 140
Joined: Dec 2002
Function sample_Grid2
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("" &sample_Grid2)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 351 135 "Dialog"
;3 QM_Grid 0x54030000 0x0 0 0 352 114 "0x0,0,0,0,0x0[]A,,,[]B,,,[]A+B,,,"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""
ret
;messages
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,sel nh.code
,,case LVN_ENDLABELEDIT ;;when ends cell edit mode
,,NMLVDISPINFO* di=+nh
,,;out "end edit: item=%i subitem=%i text=%s" di.item.iItem di.item.iSubItem di.item.pszText
,,
,,if di.item.iSubItem<2
,,,str s1 s2 s3
,,,s1=di.item.pszText ;;get text of current cell
,,,s2=g.CellGet(di.item.iItem di.item.iSubItem^1) ;;get text of other cell
,,,s3=val(s1)+val(s2)
,,,g.CellSet(di.item.iItem 2 s3) ;;set text of third cell
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:Also, is there anyway a the OpenSaveDialog could make multiple selections and populate a column in the grid?
Yes, with OpenSaveDialog you can select multiple files.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:And, how do you load a completely blank grid where the boxes remain editable. It seems like if I load an empty grid all of the cells lose there ability to be edited.
It is how QM grid works. User can add/edit only next row.
If need n rows that can be edited on click anywhere, use g.CellSet(n 0 "") under WM_INITDIALOG.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:Any chances of using a DatePicker?
It is one of supported control types in QM grid.
Posts: 1,000
Threads: 253
Joined: Feb 2008
I'm not seeing how to use the SysDateTimePick32 or something like it in QM_Grid. Could you provide an example if possible.
Thanks, Jimmy Vig
Posts: 12,073
Threads: 140
Joined: Dec 2002
Select control 'date' or 'time' in 'Grid properties' dialog.
Function dlg_grid_date_time
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str qmg3x
qmg3x=
;09/28/2010,19:04:27
;01/20/2011,19:05:02
if(!ShowDialog("dlg_grid_date_time" &dlg_grid_date_time &controls)) ret
out qmg3x
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 QM_Grid 0x56031041 0x0 0 0 224 90 "0x0,0,0,0,0x0[]date,,3,[]time,,11,"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
|