>I need to change in runtime some of the captions of labels and/or commandbutton, due to certain preferences of users. It's near to change the caption when switching between languajes.
It's much easier to do the opposite, namely set the caption to an expression. Personally I use an object , oCaptions, to store all the captions.
One example:
oCaption.cmdExit='Exit'
cmdExit.caption=oCaption.cmdExit
To change the caption, I change oCaption.cmdExit, and the caption is changed.
To populate the object, I use a table with two fields, Name and Caption. The following lines creates and initializes the object.
If Vartype(oCaption)#'O'
Public oCaption
oCaption=CreateObject('parameterX')
EndIf
Use CapList
Scan
oCaption.AddVar(trim(name),trim(caption))
Endscan
define class ParameterX as custom
function This_Access(tcMember)
if type('This.' + tcMember) = 'U'
This.AddProperty(tcMember)
endif
return This
EndFunc
function AddVar(tcMember,tcData)
AddProperty(this,tcMember,tcData)
return This
endfunc
EndDefine