Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why doesn't SelStart work?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00125098
Message ID:
00125201
Views:
14
>>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
>>
>
>Rex,
>
>SelStart goes to zero as soon as focus leaves you textbox. Focus leaves your textbox whne the button is clicked. So wehn your code is running the textbox has a selstart of 0 and it should.
>
>To do what you want you can use a form property. In the fomr desinger add a property named nSelStart and one named oTxtBox. Then in the LostFocus of each textbox put this code;
>
>THISFORM.nSelStart = THIS.SelStart
>THISFORM.oTxtBox = THIS
>
>Then in your button you can use;
>
>THISFORM.oTxtBox.Value = ;
> STUFF(THISFORM.oTxtBox.Value,THISFORM.nSelStart + 1,0,cChar)
>
>Be sure to put this line of code in the Destroy of the form though;
>
>THISFORM.oTxtBox = NULL

Jim,

Thank you for your reply. And thank you Justok, for your confirmation.

Your suggestion certainly was going to be an option for me and I guess that I will have to do it now. You see the problem was that I have another form with just one Editbox on it (for a memo) and the SelStart value DIDN'T reset to zero when it lost focus to the push button!

Regards...Rex
Rex Toomey
ISD Port Macquarie NSW
Australia

'Inside every older person is a younger person wondering what happened.'
Previous
Reply
Map
View

Click here to load this message in the networking platform