Hi all,
In a basic multiline EditField, I was trying to figure out the position
of the caret (the insertion point). This number is displayed in another
EditField (ef2).
FIRST PROBLEM :
In the case the user clicks into the EditField. I've put...
In the mouseDown event :
return true
in the mouseUp event :
self.ef2.text=str(me.CharPosAtXY(X,Y))
The number displayed in efNb is right, but the caret doesn't move at
all.
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,
increase when you move it to the left, and is even weirder when you
move the caret one line up or down.
I wrote the following bug report :
http://www.realsoftware.com/feedback/viewreport.php?reportid=fhgugvhk
IF YOU WANT TO REPRODUCE THIS BUG :
-Lay down two EditFields, ef1 and ef2. Set ef1 to multiline.
-Put in the keyDown event of ef1 :
self.ef2.text=str(me.selstart)
-Run the app, write a few lines in ef1, and move the cursor with the
mouse or with the arrows.
ANY HINT ?
Maybe the first problem comes from my handling of events. But the
second one is clearly a bug. One could argue that selStart's main
function is to select a bit of text by code, and not to return the
position of the caret. But then, how can I get the position of the
cursor ?
Any help or workaround would be really appreciated, for both problems.
Octave
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>