Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qmgrid question for advice
#1
Dear Gintaras,
I wrote 3 or 4 years ago the following macro which summarises the details of my disk system. I have not used it so far.

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

str si.getmacro(getopt(itemid) 1)
if ideb; out "%s : %s" NowT si

#compile "qmgrid"

if(!ShowDialog("DiscSystemDataGrid" &DiscSystemDataGrid 0)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 291 175 "Disk System Data"
;3 QM_Grid 0x54200001 0x200 0 0 294 154 ""
;1 Button 0x54030001 0x4 2 158 48 14 "OK"
;END DIALOG
;DIALOG EDITOR: "" 0x2030003 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,int g=id(3 hDlg)
,;use first column as noneditable
,SendMessage g LVM_QG_SETSTYLE QG_NOEDITFIRSTCOLUMN -1
,;add columns
,LvAddCol g 0 "Drive Letter" 50
,LvAddCol g 1 "D Type" 80
,LvAddCol g 2 "Volume Name" 80
,LvAddCol g 3 "Total Size (Mb)" 60
,LvAddCol g 4 "Free Space (Mb)" 60
,LvAddCol g 5 "Free Space (%)" 60
,LvAddCol g 6 "File System" 50
,LvAddCol g 7 "Path" 50
,;set column cell control default types
,SendMessage g LVM_QG_SETCOLUMNTYPE 2 QG_NONE
,SendMessage g LVM_QG_SETCOLUMNTYPE 3 QG_NONE
,SendMessage g LVM_QG_SETCOLUMNTYPE 4 QG_NONE
,SendMessage g LVM_QG_SETCOLUMNTYPE 5 QG_NONE
,SendMessage g LVM_QG_SETCOLUMNTYPE 6 QG_NONE
,SendMessage g LVM_QG_SETCOLUMNTYPE 7 QG_NONE
,;populate ICsv variable
,ICsv c=CreateCsv; c.Separator=","
,str ssi=DiscsSystemData
;,out ssi
,lpstr lssi=ssi
,c.FromString(lssi)
,
,;Make sure that ncols is equal to the number of columns in the grid that you want to set (also depends on ToQmGrid flags).
,;If not, ToQmGrid will fail.
,;out "ncols=%i, nrows=%i" c.ColumnCount c.RowCount
,
,;populate grid control
,c.ToQmGrid(g 0)
,err
,,_s.from(_error.description ":[]" ssi)
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end

,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
if(nh.idFrom=3) ret DT_Ret(hDlg gridNotify(nh))

Today I needed to run it again but it failed with the following error message :
"Error in qmgrid: previous declaration is different. Reload file or restart QM."
Let me mention that function gmgrid was downloaded from the forum at this time. I understand that something has changed with versions upgrades.

Could you please advise?
Thanks in advance.
#2
Replace
#compile "qmgrid"
to
ref GRID

Also now can add columns in dialog editor. Then don't need all the SendMessage and LvAddCol. But this code works too.
#3
Many thanks, Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)