Posts: 858
Threads: 196
Joined: Apr 2005
Posts: 12,071
Threads: 140
Joined: Dec 2002
Function
dialog_qmgrid
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("" &dialog_qmgrid)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 QM_Grid 0x54000001 0x200 4 4 216 106 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010800 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,str s=
;one, two
;three, four
,ICsv c=CreateCsv
,c.Separator=","
,c.FromString(s)
,
,int hlv=id(3 hDlg)
,LvAddCol hlv 0 "col1" 80
,LvAddCol hlv 1 "col2" 80
,
,c.ToQmGrid(hlv 0)
,
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,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
,for i 0 c.RowCount
,,out c.Cell(i 0)
,,out c.Cell(i 1)
,
,case IDCANCEL
ret 1
;messages3
;NMHDR& nh=+lParam
;sel nh.code
,;case LVN_...
,;NMLISTVIEW& nl=+lParam
,;...
,;
,;case LVN_QG_...
,;QM_NMLVDATA& nq=+lParam
,;...
Function
LvAddCol
;/
function hlv index $txt width
;Adds column to SysListView32 control that has LVS_REPORT style (1).
;To create control with this style, specify 0x54000001 style in dialog definition.
;Index of first colunm is 0.
LVCOLUMNW col.mask=LVCF_WIDTH|LVCF_TEXT
col.pszText=@txt
col.cx=width
SendMessage hlv LVM_INSERTCOLUMNW index &col
Posts: 858
Threads: 196
Joined: Apr 2005
Posts: 12,071
Threads: 140
Joined: Dec 2002