Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Always start from the beginning of the field if empty
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Always start from the beginning of the field if empty
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00980565
Message ID:
00980565
Views:
127
Hi everybody,

My manager noticed, that if the textbox uses InputMask and R format (like SSN, for example), the cursor doesn't go to the beginning of the field if clicked in the middle of the textbox like it does for the textboxes without R format. So I am trying to implement this behavior myself.

I put the following code in the Click event of the textbox:
LOCAL lcOldInputMask
WITH THIS
    lcOldInputMask = .InputMask
	IF EMPTY(.VALUE)
	    .InputMask = CHRTRAN(.InputMask,"-","")
		TEXTBOX::CLICK()
		.SELSTART = 0
		.SELLENGTH = 999
		NODEFAULT
		.InputMask = m.lcOldInputMask
	ENDIF
ENDWITH
(Similar code in the GotFocus event). I noticed, that this code doesn't work every time. It works like 3,4 times and then it selects some part of the textbox. Do you see the problem or can replicate it?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform