m.oCmd = CREATEOBJECT('empty') ADDPROPERTY(m.oCmd,'cString','wait window "test"') lc=m.oCmd.cString &lcworks whereas
&'m.oCmd.cString'
does not. It appears that macro substitution works only with base level memory variables and not with memory objects &cBtnShapeRef..visible=.t.
It is part of a listbar code I downloaded. I am wondering what the ".." does.Full code lparameters cCaption,cIcon,cTooltiptext,cItemform local nButtonStyle,cNewButtonref,cBtnShapeName,cBtnShapeRef with this .itemscount = .itemscount+1 if .firstbutton = 0 &&first button added .firstbutton=1 endif cNewButtonRef = 'this.button'+alltrim(str(this.itemscount)) nButtonstyle = .parent.buttonstyle if nButtonstyle = 0 .addobject('button'+alltrim(str(this.itemscount)),'coolbutton') else .addobject('button'+alltrim(str(this.itemscount)),'smallcoolbutton') endif endwith with &cNewButtonRef .bordercolor = this.backcolor .visible = .t. .width = this.width .buttonindex = this.itemscount cBtnShapeName = 'btnShape'+alltr(str(.buttonindex)) .addobject(cBtnShapeName,'btnshape') cBtnShapeRef=cNewButtonRef+'.'+cBtnShapeName &cBtnShapeRef..width = this.width &cBtnShapeRef..zorder &cBtnShapeRef..visible=.t. &cBtnShapeRef..tooltiptext = iif(vartype(cTooltiptext)='C',cTooltiptext,"") .itemform = iif(vartype(cItemform)='C',cItemform,"") .Icon.picture = cIcon .lblCaption.Caption = cCaption if nButtonstyle = 0 .lblCaption.width = this.width-4 .Icon.left = this.width/2-16 .top = this.parent.folderheaderheight+ (this.itemscount-1)*this.buttonheight else .lblCaption.width = this.width-24 .top = this.parent.folderheaderheight+ (this.itemscount-1)*this.buttonheight endif endwith if this.parent.folderheaderheight+(this.itemscount*this.buttonheight) > this.height this.scrolldn.visible=.t. this.scrolldn.enabled=.t. this.scrolldn.zorder endifRegards
>>x=[messagebox(thisform.caption)] >>&x >> >>x='thisform.caption' >>messagebox(&x)>
messagebox(thisform.caption)>>
>ThisForm.SelectCmd = "Select * from Customers" >>I can't do the following:
>&thisform.SelectCmd.
>
>Or any other variation. Since the "." terminates the macro expression, FoxPro would try to find a string variable called ThisForm, but that's of course not available. So, I have to do this:>lcCmd = thisform.SelectCmd >&lcCmd. && Don't need the period in this case, but just making the point. No pun intended. >>The issue of prefixing literals with "m." is the same thing.
Local lcSelectCmd >lcSelectCmd = "Select * from Customers" >&m.SelectCmd. && Will look for a string variable "m" >&lcSelectCmd. && Is okay. >