07-23-2020, 09:16 PM
I am trying to add a new row to the grid via a button. the functionality works BUT the text strings sits in the first cell and doesnt get allocated to each cell in the row. i even tried with g.FromCSV(_s, ",") and it fails. whats the proper syntax? whats the diff between RowAddSetSA (whats SA & MS mean)
thanks *Screenshot below
case 4
entire code
thanks *Screenshot below
case 4
entire code
\Dialog_Editor
Shows how to use DlgGrid variable and grid notifications.
All this is not necessary in most cases. Instead you can define style and columns in dialog editor. Then you can add/get data using the dialog variable.
str dd=
BEGIN DIALOG
0 "" 0x90C80AC8 0x0 0 0 352 135 "Dialog"
3 QM_Grid 0x54030000 0x200 0 0 352 114 ""
4 Button 0x54032000 0x0 4 116 48 14 "Add Row"
1 Button 0x54030001 0x4 120 116 48 14 "OK"
2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
END DIALOG
DIALOG EDITOR: "" 0x2040A00 "" "" "" ""
if(!ShowDialog(dd &sub.DlgProc)) ret
#sub DlgProc
function# hDlg message wParam lParam
DlgGrid g.Init(hDlg 3)
sel message
case WM_INITDIALOG
add columns
g.ColumnsAdd("col0,10%[]edit,10%[]edit+button,20%,16[]edit multiline,20%,8[]combo,15%,1[]check,10%,2[]read-only,15%,7" 1)
optionally add data using CSV string
_s=
a1,b1,c1,d1,e1,Yes,g1
a2,b2,"""c2""","line1
line2","1,2",," g2 "
out _s
g.FromCsv(_s ",")
or you can add data from an ICsv variable
case WM_DESTROY
case WM_COMMAND goto messages2
ret
messages2
sel wParam
case IDOK
#endregion
case 4
_s=
new,new1,new2,new3,new4,Yes,new5
out _s
g.RowAddSetMS(0 _s 7 0)
ret 1