Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The m. variable thing, the sequel
Message
From
27/01/2005 15:27:56
 
 
To
27/01/2005 13:03:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00969478
Message ID:
00981441
Views:
54
I concur. More specifically
m.oCmd = CREATEOBJECT('empty')
ADDPROPERTY(m.oCmd,'cString','wait window "test"')
lc=m.oCmd.cString
&lc
works whereas
&'m.oCmd.cString'
does not. It appears that macro substitution works only with base level memory variables and not with memory objects

Could someone please enlighten me as to what the this code segment is referencing. I have included the full method further down in case more context is needed.
       &cBtnShapeRef..visible=.t.
It is part of a listbar code I downloaded. I am wondering what the ".." does.

regards
Geoff Scott
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
endif
Regards
Geoff Scott

>Hi, Gary-
>
>>I must have missed the real question here.
>
>The difference is subtle. It's not whether the variable's value has a period, but whether the variable's literal has one.
>
>>I put:
>>x=[messagebox(thisform.caption)]
>>&x
>>
>>x='thisform.caption'
>>messagebox(&x)
>
>In your example, The string "x" has been evaluated (no period in "x") and resulted in a perfectly legitimate command.
>
messagebox(thisform.caption)
>>
>>Isn't this what we're talking about? I must have misunderstood the issue.
>
>Let me give you an example, and hopefully, that'll help explain the difference. Let's say I have a form that builds a Select statement that I'll run before printing a report. So, I have a custom property called SelectCmd. Something like:
>
>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.
>
May all your weeds be wildflowers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform