05-16-2011, 07:50 AM
True your code doesnot add rows on enter. I am providing my code please check and reply.
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
#compile "qmgrid"
if(!ShowDialog("Confirm_Orders" &Confirm_Orders 0)) ret
BEGIN DIALOG
0 "" 0x90C80AC8 0x100 0 0 265 191 "Confirm Orders"
3 QM_Grid 0x56031041 0x0 0 0 264 162 "0x3,0,0,0,0x0[]"
4 Button 0x54032000 0x0 30 170 48 14 "Submit"
5 Button 0x54032000 0x0 192 170 48 14 "Cancel"
END DIALOG
DIALOG EDITOR: "" 0x2030208 "" "" ""
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 "Scrip" 80
,LvAddCol g 1 "Quantity" 70
,LvAddCol g 2 "Sell Rate" 70
,LvAddCol g 3 "Stop Loss" 70
,LvAddCol g 4 "Trigger" 70
,;populate ICsv variable
,ICsv c=CreateCsv(1)
,ARRAY(str) orders
,orders.create(2 3)
,orders[0 1]="Hi"
,orders[0 2]="Hello"
,int i nc(orders.len(1))
,for(i 0 orders.len)
,,c.AddRowSA(i nc &orders[0 i])
,,out orders[0 i]
,c.ToQmGrid(g)
,out "ncols=%i, nrows=%i" c.ColumnCount c.RowCount
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,;get and show all cells
,c=CreateCsv; c.Separator=","
,c.FromQmGrid(id(3 hDlg))
,str s
,c.ToString(s)
,mes s
,
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
if(nh.idFrom=3) ret DT_Ret(hDlg gridNotify(nh))
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
#compile "qmgrid"
if(!ShowDialog("Confirm_Orders" &Confirm_Orders 0)) ret
BEGIN DIALOG
0 "" 0x90C80AC8 0x100 0 0 265 191 "Confirm Orders"
3 QM_Grid 0x56031041 0x0 0 0 264 162 "0x3,0,0,0,0x0[]"
4 Button 0x54032000 0x0 30 170 48 14 "Submit"
5 Button 0x54032000 0x0 192 170 48 14 "Cancel"
END DIALOG
DIALOG EDITOR: "" 0x2030208 "" "" ""
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 "Scrip" 80
,LvAddCol g 1 "Quantity" 70
,LvAddCol g 2 "Sell Rate" 70
,LvAddCol g 3 "Stop Loss" 70
,LvAddCol g 4 "Trigger" 70
,;populate ICsv variable
,ICsv c=CreateCsv(1)
,ARRAY(str) orders
,orders.create(2 3)
,orders[0 1]="Hi"
,orders[0 2]="Hello"
,int i nc(orders.len(1))
,for(i 0 orders.len)
,,c.AddRowSA(i nc &orders[0 i])
,,out orders[0 i]
,c.ToQmGrid(g)
,out "ncols=%i, nrows=%i" c.ColumnCount c.RowCount
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,;get and show all cells
,c=CreateCsv; c.Separator=","
,c.FromQmGrid(id(3 hDlg))
,str s
,c.ToString(s)
,mes s
,
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
if(nh.idFrom=3) ret DT_Ret(hDlg gridNotify(nh))