06-21-2013, 04:06 AM
Macro Macro2109
Function DynamicGrid
Function DynamicGrid_dialog
Function DialogDefinitionReplace
QM grid control does not have row labels. Use first column, like now. In editable grid can make first column read-only.
Function DynamicGrid
;/Dialog_Editor
function Dlgw Dlgh $gridCSV
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 200 119 "Stats in detail"
;3 QM_Grid 0x54030000 0x0 0 0 200 94 "0x10,0,0,0,0x0[]'' '',,,[]A,,,[]B,,,[]C,,,[]D,,,"
;1 Button 0x54030001 0x0 98 102 48 14 "OK"
;2 Button 0x54030000 0x0 150 102 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030507 "" "" "" ""
DialogDefinitionReplace 2 dd 0 Dlgw Dlgh
DialogDefinitionReplace 2 dd 3 Dlgw+1 Dlgh-21
DialogDefinitionReplace 1 dd 1 Dlgw/2-55 Dlgh-19
DialogDefinitionReplace 1 dd 2 Dlgw/2-5 Dlgh-19
str controls = "3"
str qmg3x
qmg3x=gridCSV
if(!ShowDialog(dd &DynamicGrid_dialog &controls)) ret;/
function# hDlg message wParam lParam
if(hDlg) goto messages
ret
;messages
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,g.ColumnsWidthAdjust(5);; n columns=5
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
ret 1;/
function what str&dd ctrlID v1 v2 ;;what: 0 style/exstyle, 1 x/y, 2 width/height
;Replaces two numeric values in dialog definition string.
;dd - variable containing dialog definition (BEGIN DIALOG...END DIALOG).
;ctrlID - control id, or 0 for dialog. It's the first number in a line.
;v1, v2 - new values. Coordinates are in dialog units.
str rx
sel what
,case 0 rx=F"^({ctrlID} .+?) 0x\w+ \w+"
,case 1 rx=F"^({ctrlID} .+? 0x\w+ \w+) \d+ \d+"
,case 2 rx=F"^({ctrlID} .+? 0x\w+ \w+ \w+ \w+) \d+ \d+"
,case else end ERR_BADARG
if(dd.replacerx(rx F"$1 {v1} {v2}" 4|8)<=0) end ERR_FAILEDQM grid control does not have row labels. Use first column, like now. In editable grid can make first column read-only.
