Page 1 of 1

Text delimiters

Posted: Tue Feb 06, 2018 10:08 am
by TWolfe
The following line of code has compiled correctly for years. Now a new user is trying to compile my code on a new computer and they are getting compile errors. Any ideas??

@ 5,20 DCSAY IIF(xx='Y',"Yes","No")

The following line (without the single quotes) compiles fine on the new machine????
@ 5,20 DCSAY IIF(xx="Y","Yes","No")

Re: Text delimiters

Posted: Tue Feb 06, 2018 10:24 am
by rdonnay
You have discovered a bug in the Xbase++ pre-processor which shows up in eXpress++ builds 263 and later.

It is because of the following code that was added to DCDIALOG.CH:

Code: Select all

     ;DC_GetListSet(DCGUI_GETLIST,aGETLIST_VARS,                            ;
                     {'DCSAYGET',<(oObject)>,<(oParent)>,<(cText)>,         ;
                       #<nRow>,#<nCol>,#<nWidth>,#<nHeight>} )
I added this as a new feature to support the improvements to the eXpress++ designer.
Unfortunately, the compiler will fail if there is an expression with mixed quotes, because the compiler will wrap everything in brackets if there are mixed quotes (single,double). I don't have a simple solution to this other than to tell you to use all single quotes or all double quotes in any expression used in a DCSAY or DCSAY..GET.

Re: Text delimiters

Posted: Tue Feb 06, 2018 10:41 am
by TWolfe
Thanks Roger,

So:

@ 12,40 DCSAY {||"Current 'Other' Balance"}

Must be changed to:

@ 12,40 DCSAY {||"Current "+chr(39)+"Other"+chr(39)+" Balance"}

A real pain to change in all my code, but as long as I know the rules ....
New users are using later versions of Express, I use 254

SIDE NOTE:

GETTOOLTIP "To use existing list, enter 'Y'"

The above seems to be accepted without error??

Re: Text delimiters

Posted: Tue Feb 06, 2018 11:15 am
by rdonnay
Let me see if I can find a better solution for you by modifying DCDIALOG.CH.

Re: Text delimiters

Posted: Tue Feb 06, 2018 11:54 am
by rdonnay
Your sample does not seem to show a problem with the compiler.
It preprocesses to the following:

Code: Select all

;DC_GetListSet(GetList,70, {'DCSAYGET',,,[{||"Current 'Other' Balance"}], "12","40","50",""} )
So the stringify option <(cText)> works ok in this case, however it does not work in all cases.

If I remove test stringify option and change it to <cText>, then it will preprocess to the following:

Code: Select all

;DC_GetListSet(GetList,70, {'DCSAYGET',,,{||"Current 'Other' Balance"}, "12","40","50",""} )
This still works with the designer, so I am going to suggest that you try the attached DCDIALOG.CH which removes the stringification.