>>>>>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?
>>>>
>>>>Try this snippet (it should work, however I wouldn't advise to use Whem event):
>>>>with thisform.edit1
>>>> .value=replicate('x',250)
>>>> .selstart=len(.value)
>>>> .setfocus
>>>>endwith
>>>>keyboard '{DNARROW}'
>>>
>>>
>>>Why would you not advise to use the when event?
>>
>>This is 'legacy' event providing space for When snippet when converting 2.x applications. You can use instead e.g. Gotfocus, or some other event.
>
>Where did you hear or learn of the 'when' event being 'legacy'?
>
That's JMHO.
When that statement above is executed in the 'when' or 'gotfocus' methods/events the user does not see the insertion point, but if you place the code in the click event/method then the user will see the insertion point. Is there a reason for this?
It works on my machine from either When or GotFocus.
Edward Pikman
Independent Consultant