[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Macros half-evaluation

From   "Sergiy Radyakin" <>
To   "" <>
Subject   st: Macros half-evaluation
Date   Sun, 19 Aug 2007 16:18:59 -0400

Hello Statalisters,

I have a dialog form, and an EDIT control on that form contains a
string with possibly local macros embedded in it. E.g.

"Text `alpha' other text"

I need to save/read the contents of this field to/from text file.
If I save the value directly, e.g.

file write ConfigFile `" `"`.my_dlg.main.fi_save.value'"' "'  _n

, the macro, which is contained in the value is evaluated and the
result of that is saved.

If I preclude evaluation with a " \ ",
file write ConfigFile `" `"\`.my_dlg.main.fi_save.value'"' "'  _n
then I have
in my file, which will be evaluated when the file is to be read (which
is wrong).
So how do I tell Stata, that the string that I want to save is the
VALUE of an EDIT control (equally applies to all other controls and
string properties) taken AS-IS with all locals left unevaluated? Note
classutil des .my_dlg.main.fi_save.value
also shows the evaluated value, rather than the "contents" of the field

For those who do not want to deal with the dialogs, here is a similar
problem with locals:

local b "bar"
local f `"foo \`b'"' // Have to preclude with \
di `"f is:`f'"'
di `"b is:`b'"'
di `"\f is:\`f'"'
di `"\b is:\`b'"'
local c "`f'"
di `"c is:`c'"'
// I want to see: foo `b'

Any ideas how can I get the contents of the macro in this way without
all macros that it contains being evaluated?

Thank you,
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index