Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Positioning cursor in an editbox
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00048699
Message ID:
00048754
Views:
21
>>I want to position to the end of the data in my editbox when I enter it. I use the selstart property to do this. In the when method I put the following command "THIS.SELSTART = LEN(THIS.VALUE)". When I enter the editbox, the insertion point disappears, I think it moves to the end of the data but the editbox does not scroll to make it visible. When I put the same statement in the CLICK method of the editbox, it works fine.
>> To recreate this behavior, do the following:
>>1) Place an editbox control on a form.
>>2) Size the editbox so it is one line high and about 200 pixels wide.
>>3) In the init method place a statement like:
>> this.value = "This is a long string which is too wide to display all at once in the editbox". Be sure the string is too long to display all at once.
>>4) In the when method place the following statement:
>> THIS.SELSTART = LEN(THIS.VALUE)
>>5) In the clock method, place the same statement:
>> THIS.SELSTART = LEN(THIS.VALUE)
>>6) Run the form and see what you get.
>>
>>Why is the WHEN method not working properly? Bug or bad programming?
>Bret,
>
>Move this code to the GotFocus and also include a NODEFAULT command in it.
>
>The GotFocus sets the SelStart to a default setting automatically. When fires before GotFocus so your When code is doing what you ask but the GotFocus is undoing it on you.
>
>I Think of the WHEN/GOTFOCUS and VALID/LOSTFOCUS events this way and it helps me;
>
> WHEN: Can the user get in
> GOTFOCUS: the user is comming in so do what you need to get ready for them
>
> VALID: Can the user get out
> LOSTFOCUS: The suer is leaving so respond to the leaving


We tried the code (THIS.SELSTART = LEN(THIS.VALUE)) in the gotfocus with a NODEFAULT after it and it did not work.
Is this what you had in mind? We are testing it on a form with only the edit box and a quit button, nothing else. The edit box has
to be smaller that the line we are trying to display (that is why we are moving to the end of the line when a user TABS or moves through it.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform