Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Summing Column In QM Grid
#1
What I want is the edit box to update constantly...really on a change to the Grid...I put in the update button only to show the function I wish to perform.

Function Sum_Column
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 128 239 "Sum_Column"
;3 QM_Grid 0x54200001 0x200 5 0 120 195 ""
;1 Button 0x54030001 0x4 9 216 48 14 "OK"
;2 Button 0x54030000 0x4 78 216 48 14 "Cancel"
;4 Edit 0x54030080 0x200 66 198 60 15 ""
;5 Static 0x54000000 0x0 35 200 20 10 "Total"
;6 Button 0x54032000 0x0 6 198 27 18 "Update"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
str controls = "5"
str e5
if(!ShowDialog("Sum_Column" &Sum_Column &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,;Tally
,ICsv c=CreateCsv
,int hlv=id(3 hDlg)
,LvAddCol hlv 0 "Col1" 85
,LvAddCol hlv 1 "Col2" 85
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,c=CreateCsv ;;create again because we use local variable, just to simplify grid populating and retrieving data
,c.FromQmGrid(id(3 hDlg) 0)
,int i
,CURRENCY i2
,for i 0 c.RowCount
,,i2=i2+val(c.Cell(i 1) 2)
,_s=i2
,_s.setwintext(id(4 hDlg))
,case IDOK
,case IDCANCEL
ret 1

Thanks for help


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)