![]() |
#2
gs25367856782021-10-20 07:46
|

LOCAL fs,n
myvalue=this.value
DO case
case TYPE('myvalue')='C'
THIS.SELSTART=0
THIS.SELLENGTH=LEN(ALLTRIM(myvalue))
case TYPE('myvalue')='N'
fs=FONTMETRIC(6,this.FontName,this.FontSize)+FONTMETRIC(16,this.FontName,this.FontSize)
fs=fs/2
n=round(this.Width/fs,0)
THIS.SELSTART=n-LEN(STR(myvalue))
THIS.SELLENGTH=LEN(STR(myvalue))
ENDCASE
myvalue=this.value
DO case
case TYPE('myvalue')='C'
THIS.SELSTART=0
THIS.SELLENGTH=LEN(ALLTRIM(myvalue))
case TYPE('myvalue')='N'
fs=FONTMETRIC(6,this.FontName,this.FontSize)+FONTMETRIC(16,this.FontName,this.FontSize)
fs=fs/2
n=round(this.Width/fs,0)
THIS.SELSTART=n-LEN(STR(myvalue))
THIS.SELLENGTH=LEN(STR(myvalue))
ENDCASE