>>> SECOND PROBLEM :
>>> If the user moves the caret with the keyboard arrows, the only
>>> function
>>> I can use is selStart(), with :
>>>
>>>     self.ef2.text=str(me.SelStart)
>>>
>>> The problem is that selStart() doesn't work properly. The returned
>>> number can decrease when you move the caret one character to the
>>> right,
>>> ...

Indeed, you're right; it should increase when you move to the right.  
I didn't read carefully.

You are using the code in the KeyDown event, right?
That event occurs before the key is actually processed.

So, if you press the left arrow, then the right arrow, you have this  
sequence:
KeyDown event (left arrow)
--By not returning true, the key takes effect here.
TextChange event (if the key changes the text, obviously)
SelChange event (if the key changes the selection, as opposite as the  
delete key when nothing is selected)

KeyDown event (right arrow)
--By not returning true, the key takes effect here.
TextChange event (if the key changes the text, obviously)
SelChange event (if the key changes the selection, as opposite as the  
delete key when nothing is selected).

If you handle the keys in the KeyDown event, the key's effect has  
"not yet" occurred. When, in the example above, you press the right  
arrow, you only have the result of the left arrow.

Try putting it in the SelChange, if it works for you.

> I don't think so. The Language reference defines SelStart as "The
> position of the insertion point"  and SelLength as "The number of
> highlighted characters.". You select the 5 first characters of
> "abcdefgh" with :
>    ef1.SelStart=0
>    ef1.SelLength=5

You're right about SelStart, but your statement "One could argue that  
selStart's main function is to select a bit of text by code", in my  
opinion, refers to the SelLength, since you can't select anything  
with only SelStart.

Why do you say "If the user moves the caret with the keyboard arrows,  
the only function I can use is selStart()"? You can always use any  
function.

Maybe I have read again too fast, but, about the second problem, I  
don't know what you want to achieve. Why do you want to use SelStart?

Hope this helps
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to