Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Input Cursor control in a textbox
Message
De
18/11/1999 13:26:55
 
 
À
18/11/1999 09:17:01
Cliff Palmer
Palmer Computer Services
Jackson, Mississippi, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00292386
Message ID:
00292574
Vues:
17
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform