Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Input Cursor control in a textbox
Message
From
18/11/1999 13:26:55
 
 
To
18/11/1999 09:17:01
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00292386
Message ID:
00292574
Views:
18
Hi Cliff.

>> I need to force the input cursor to a position in a text box other than the far left. For example, if the textbox.value is "ABCDEFG12345" I need to be able to position the cursor on a character other than "A". I am using VFP 5.0. <<

You can put code like this in the textbox's GotFocus()
LOCAL lnCursorPos, lnSelLen
DODEFAULT()

DO CASE
  CASE < Some Condition >
     lnCursorPos = 1
  CASE < Some Other Condition >
     lnCursorPos = 2
  .
  .
  .
  OTHERWISE
     *** Position the cursor at the beginning of the value in the text box
     lnCursorPos = 0
ENDCASE

WITH This
  lnSelLen   = LEN( .Value ) - lnCursorPos
  .SelStart  = lnCursorPos
  .SelLength = lnSelLen
ENDWITH

NODEFAULT
You need the DODEFAULT() and NODEFAULT here because the default behavior of the VFP in GotFocus is to reset SelStart and SelLength properties.

Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform