Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Willem-Jan van Ede
  Where is Willem-Jan van Ede?
 Zeist
 Netherlands
 Willem-Jan van Ede
 To: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 Tags
Subject: RE: macro substitution with form properties
Thread ID: 34081 Message ID: 34104 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Forms
Date: Tuesday, December 09, 2003 8:45:19 AM         
   


> > Hi there,
> >
> > I have some problems with macro substitution with form properties and i did some testing in a brand new form:
> > in the init i run this code:
> >
> > thisform.AddProperty('ctest')
> > thisform.ctest = "'xxx','yyy','zzz'"
> > 
> > MESSAGEBOX(INLIST('xxx', thisform.ctest ))
> > 

> > When i run the form the messagebox gives me ".f.".
> >
> > Instead of using the form property i save the value to a variable:
> >
> > thisform.AddProperty('ctest')
> > thisform.ctest = "'xxx','yyy','zzz'"
> > lctest=thisform.ctest
> > 
> > MESSAGEBOX(INLIST('xxx', &lctest ))
> > 

> > Now when i run the form the messagebox gives me ".t."!!!
> >
> > Can you tell me how to make the first example work, WITHOUT using variables?
> >
> > T.i.a.
> >
> > Willem-Jan van Ede
> >
> > Vektis BV
> > The Netherlands
> >
> > "I still have more questions than answers..."
> You can't. From the Macro Substitution in VFP Help...
>
> & VarName
> Specifies the name of the variable or array element to reference in the macro substitution. Do not include the M. prefix that distinguishes variables from fields. Such inclusion causes a syntax error. The macro should not exceed the maximum statement length permitted in Visual FoxPro.
> A variable cannot reference itself recursively in macro substitution. For example, the following generates an error message:
>
> STORE '&gcX' TO gcX
> ? &gcX
> Macro substitution statements that appear in DO WHILE, FOR, and SCAN are evaluated only at the start of the loop and are not reevaluated on subsequent iterations. Any changes to the variable or array element that occur within the loop are not recognized.
>
> .cExpression
> The optional period (.) delimiter and .cExpression are used to append additional characters to a macro. cExpression appended to the macro with .cExpression can also be a macro. If cExpression is a property name, include an extra period (cExpression..PropertyName).
>
>
> KTB

Thanx Ken,

I solved it this way (Thanks to my dear collegue Boudewijn L. ):
thisform.AddProperty('ctest')
thisform.ctest = "'xxx','yyy','zzz'"
MESSAGEBOX('xxx' $ thisform.ctest )


Willem-Jan van Ede

Vektis BV
The Netherlands

"I still have more questions than answers..."

ENTIRE THREAD

macro substitution with form properties Posted by Willem-Jan van Ede @ 12/8/2003 5:38:26 PM
RE: macro substitution with form properties Posted by Ken Blum @ 12/8/2003 8:19:35 PM
RE: macro substitution with form properties Posted by Willem-Jan van Ede @ 12/9/2003 8:45:19 AM