Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with @ get

Status
Not open for further replies.

SYN

Programmer
Nov 2, 2000
45
NL
Hi,
I'm still working with @ get in vfp. As long as non-proportional fonts are used, there is no problem but if I use for example Arial, the width of the get doesn't correspond with the variable. So I'm changing the width with the size parameter. But... now there is more input possible then the length of the variable. An example:

Myvar = space(6)
@ 1,1 get Myvar size 1,10 font "Arial" , 10
read

I was expecting an input of 6 characters but due to size (which is needed for the display) it's possible to get more
characters as 6. Does anyone recognize this and got a suggestion (the picture/function isn't an option)
 
SYN,
If you are using VFP, why would you still be using @.. GET / READ?
Why can't you use the PICTURE clause? Without it, the SIZE is used to determine field width.
Code:
CLEAR
Myvar = space(6)
@ 1,1 get Myvar PICTURE "XXXXXX" size 1,10 font "Arial" , 10 
read
?myvar
This works as you'd expect, but if the data is " 10 is still too small.

Rick

Note: Since this is really a VFP "problem", you should post it there.
 
Rick,

I'm rewriting fpd code to vfp. I've got my own 'get' function but this function doesn't get (always) the picture-parameter. But, your answer confirmed my own thoughts. Do you know a good function which determine the size (based on the font and it's size?)

 
Maybe something like this?:

Myvar = space(6)
@ 1,1 get Myvar size 1,10 font "Arial" , 10 VALID VarLength(MyVar) ERROR "Input too long...."
read
.
.
.
FUNCTION VarLength
PARAMETER MyVarL
ValidLen = IIF(LEN(ALLTRIM(MyVarL))<=6,.T.,.F.)
RETURN ValidLen

 
No, I'm sorry, this is not an option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top