Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Textbox
Message
De
16/04/2000 12:13:39
 
 
À
16/04/2000 06:02:45
Liam O'Hagan
O'Hagan Programming Ltd
Irlande
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00360078
Message ID:
00360124
Vues:
10
>Moises has raised an interesting point. I was asked a very similar question recently by a client. Another client asked me if I could save the position in a text box that she was editing so that, if she tabbed off it and tabbed back, she could resume editing at the point she left. I don't think there is a way to
>establish the current position in a text box or edit box but perhaps someone can tell me I'm wrong ?
>

You can, but at the cost of Windows compatibility. Create a subclass of the textbox with two custom properties, OldSelStart and OldSelLength, initializing both to 0. Add the following to the GotFocus event:

PROCEDURE GotFocus
this.SelStart = this.OldSelStart
this.SelLength = this.OldSelLength
DODEFAULT()
NODEFAULT
ENDPROC

Add the following to the LostFocus event:

PROCEDURE LostFocus
this.OldSelStart = this.SelStart
this.OldSelLength = this.SelLength
DODEFAULT()
ENDPROC

Note - doing this gives up the option that the user has now to click to a position in the textbox from another control and have the cursor positioned as they'd like. Once in the subclassed textbox, you can select, etc using the mouse as normal. This also sacrifices the normal behavior for a textbox that would otherwise select all on entry. YMMV - my experience has been that the end-user will get very, very confused.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform