On 14 apr 2006, at 22.04, Joseph J. Strout wrote:

At 9:18 PM +0200 4/14/06, Sven E Olsson wrote:

Just an another problem about how to detect the Length of selected text in an Editfield.

Why not just use .selLength? (Though I see that you say it produces the same result, which is what it should -- it's just more efficient.)

and my code is (in the keyDown event)

l = len(me.selText) or l = me.seltext.Len
l = 2, and that is correct

But if i select text like this: T[his] is my text

l is 0 (zero) in both case, and it should be 3!

What key are you pressing to trigger KeyDown? Perhaps that's changing it. Have you tried displaying the .selLength in a StaticText from, say, a Timer? I've used this many times and never had it fail on me.

At 9:30 PM +0200 4/14/06, Sven E Olsson wrote:

I cant assign me.SelText to an string

myString = me.seltext

l = len(myString)

l = 0 (zero), and the debugger show length 0 ASCII for myString


Well, that's consistent. I suspect that the selection really IS empty at the time your code is running.

Best,
- Joe

--



It was some confusing that it works on an whole word but not on an half word. And to the left of an whole word is space,
so I am soon getting it. ...

Yes the string is empty...
Trigger ? a whole bunch of control characters...
So the fix going to be something like: if not Keyboard.Controlkey ......

Thanks for your reply!

Sven E




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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to