Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why doesn't SelStart work?
Message
De
09/08/1998 21:29:12
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00125098
Message ID:
00125135
Vues:
17
>I have a textbox field on a form.
>
>At the bottom of the form, I have a push button to a foreign character listbox on another form. Whilst editing the textbox field, I want to return a selected foreign character back from the listbox/form, and insert it into the textbox at the position I was last when I hit the push button.
>
>This is my code in the push button's click event -
>
>LOCAL cChar
>cChar = ""
>nSelStart = THISFORM.txtAddress.SelStart
>DO FORM eForeign TO cChar
>
>WITH THISFORM.txtAddress
> IF !EMPTY(cChar)
> .Value = STUFF(.Value,.SelStart + 1,0,cChar)
> .Refresh()
> ENDIF
> .SetFocus()
>ENDWITH
>
>Unfortunately, it doesn't work. Mainly because "nSelStart" always is returned as zero - I checked it out through the debugger.
>
>Can anyone please provide a solution. I have searched the "thread" without success.
>
>Thanx in anticipation.
>
>Rex Toomey
>Australia.


agree with Jim statement, the value has been reseted!

But your coding has given you another method to do:

> .Value = STUFF(.Value,nSelStart + 1,0,cChar)

because you have used a local variable to carry the value of .selStart!
Why not use it?!



if possible, I disagree to put all the extra property at form but instead create a new object for it!
Because maybe in one day, you discover that the control need to remove for some
reason and the variable still leave in form! This is away from the thm. of OOP! OOP claim that whatever object is added or removed, everything go alright!
Anyway, Jim, this is a discussion only, you can point out what I said wrong!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform