Posts: 14
Threads: 6
Joined: Feb 2018
03-10-2019, 09:00 AM
(This post was last modified: 03-10-2019, 09:10 AM by zandar.)
Hi Gintaras,
in a dialog there are two grids, both of them getting their values from a csv file.
While grid 2 is populated with the values correctly separated by the defined separator (";"), grid 1 does not to respect the defined separator (":").
It separates the values by comma (,) instead:
any help?
thanks in advance.
Posts: 12,090
Threads: 142
Joined: Dec 2002
This code works well. How to change it to make it ignore separator ":"?
Function
Dialog3
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 QM_Grid 0x56031041 0x200 8 8 208 50 "0x3,0,0,0x0,0x0[]A,,,[]B,,,"
;4 QM_Grid 0x56031041 0x200 8 64 208 50 "0x3,0,0,0x0,0x0[]A,,,[]B,,,"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""
str controls = "3 4"
str qmg3x qmg4x
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,goto gInit
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;gInit
str txCsv=
;aaa, bbb: ccc
;ddd, eee: fff
DlgGrid g1.Init(id(3 hDlg))
g1.FromCsv(txCsv ":")
DlgGrid g2.Init(id(4 hDlg))
ICsv txTable._create; txTable.Separator=":"; txTable.FromString(txCsv)
g2.FromICsv(txTable)
Posts: 14
Threads: 6
Joined: Feb 2018
thank you Gintaras,
I've modified the grid in your example to mirror the one in my dialog and populated both with the very same csv file and the same three lines of code, but a quite strange difference emerges.
In your dialog the values are splitted correctly at the colon, and both fields of the grid get their correct values.
In my one the incorrect separation persists.
The picture below shows a parallel between the two dialogs, and in my one (on the left) no "Dosaggio" value is populated except the one from the only line containing a
comma ("OSTEOFOS D3*OS 30BUST1
,2g800UI:n/d") that so apperas to act as the separator, splitting the line in "
OSTEOFOS D3*OS 30BUST1" and "
2G800UI: n/d" instead of the expected split at the
colon:
Could you help me to solve this problem?
many thanks again
Posts: 12,090
Threads: 142
Joined: Dec 2002
Maybe some code is in wrong place. Need to see all code.
Posts: 14
Threads: 6
Joined: Feb 2018
03-10-2019, 03:37 PM
(This post was last modified: 03-10-2019, 03:44 PM by zandar.)
Hi Gintaras,
I've found the error and it's a very stupid one.
I have substituted a multiline edit control with a grid but I forgot to delete the code for the first…
Now the dialog works as expected.
Sorry to have bothered you...
Thanks again