Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Determine # of characters input in a field
Message
From
28/02/2003 15:32:17
 
 
To
28/02/2003 15:11:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00759242
Message ID:
00759645
Views:
12
The "end" key problem is simple to fix, you just use a code something like this:

in the keypress event:

if nKeyCode=6 && End
this.selstart = your formula for the new length, something like (len((chrtran...))
endif



>I tried to use the normal form as a way to set a filter by blanking all fields and having the user type in whatever he wants to filter on.
>
>This also requires you to know when a space bar has been pressed.
>
>Similar to your solution I filled the box with non space (chr(32)) characters and strtran'ed them out. I used chr(95), which are underscores - "_".
>
>Thanks to the Web people are used to filling out fields and having underscores disappear.
>
>Using replicate(chr(95),200) causes a problem. If the user hits "end" while editing he goes to the end of the 200 characters. It looks like what he typed has disappeared. Then when he leaves the textbox it seems to reappear.
>
>Finally as I worked thru the problems I was faced with having to track KeyPresses anyway which help to defeat the idea of providing an easy way to set a filter.
>
>>Hello Allan
>>
>>I needed that feature in an application I made in the good, old DOS-days, and it was really very simple then:
>>
>>I started with a variable with the value of REPLICATE(CHR(178),200). In DOS CHR(178) is a block with grey background, 200 gave the value a length which was way too long. My client could only see a very small portion of the value. If my client hit backspace and/or Delete too many times they could in theory break my procedure, but it never happened. In VFP you can make it much longer to be on the safe side.
>>
>>When my customers entered their input, the CHR(178)'s were replaced with their input. So I could simply use a chrtran() to remove the redudant CHR(178)'s and I knew what they had entered, including all spaces, also the leading and trailing, plus the length of their input.
>>
>>I never had the same need in VFP, but it should be very easy to adapt my solution. Either you can use a font with a symbol similar to CHR(178) in DOS, like Foxfont, or you can experiment with some other CHR-value.
>>
>>Good luck!
Previous
Reply
Map
View

Click here to load this message in the networking platform