Jump to content

Get Cursor Position in Rich Edit


JeyJ0
 Share

Go to solution Solved by jaberwacky,

Recommended Posts

I hope this is all you need:

Local $cPos = _GUICtrlRichEdit_GetSel($Edit)
   $cPos = _GUICtrlRichEdit_GetCharPosFromXY($Edit, $cPos[0], $cPos[1])
If there are questions left, feel free to ask!^^

 

PS: This code works for me, except the part that doesn't work! I mean I get no errors... But it doesn't work as it should.

 

 

Your problem is right there on lines 9 and 10 of the script you posted.

 

You find the caret position on line 9.  $cPos is given an array that contains the inter-character positions at the start and end of the selection.  If no text is selected, then both elements of the array are the same.  That part works just fine, I guarantee it.

 

Then on line 10, you break it.  You pass the array elements into _GUICtrlRichEdit_GetCharPosFromXY.  It's supposed to take a control handle, but you gave it a control ID.  Big difference.  It's supposed to take x- and y-coordinate values, but you gave it the inter-character positions instead.  No wonder you get nothing back from it.  All 3 parameters were invalid.  o_O

Edited by Artisan
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...