>>=" =" (Equal-apostoph-space-equal-apostroph"
>>
>>
>>>Can't get this to work... and can't find it in help either, and almost two years have passed since I last did this. UT search doesn't allow equal sign in the search string, and there don't seem to be too many label-related messages in this category anyway. So - question:
>>>
>>>I want to use a =expression as a caption of a label. But it doesn't refresh - whatever value the expression had when the label was instantiated, that value remains. I also tried =(expression), same result.
>>>
>>>Was there some trick to this?
>
>OK guys, you got me all wrong.
>
>1) I don't want to display an equal sign
>2) I know I can put any code into label's refresh - that's what I wanted to avoid
>3) I want to use the VFP's native behavior for cases when the .caption begins with an equal sign, but it evaluates the expression only once.
>
>How do I get it to re-evaluate the expression when the label refreshes? Without code, that is. I know I can write my own refresh - but then didn't need the special .caption format for that, I could have used a custom property to store the expression.
I don't know if there really is a special magical format for that. I needed to code at least in refresh:
Public oForm
oForm = Createobject('myForm')
oForm.Show()
Define Class myForm As Form
Add Object myLabel As Label
Add Object myTimer As Timer With Interval=1000
Procedure Init
Set Seconds On
This.myLabel.Caption = "=ttoc(DATETIME())"
Endproc
Procedure myTimer.Timer
Thisform.Refresh()
Endproc
Procedure Refresh
With This.myLabel
.Caption = .ReadExpression('Caption')
Endwith
Endproc
Enddefine
Cetin