Edit/RichEdit Controls caret position

new topic     » topic index » view thread      » older message » newer message

Hello all,

I've been messing around with Edit Controls and have some interesting news.
I went looking for some info on MLE's and found several posted Q?'s
that people on this list had asked about Caret positions.

Im not sure this has been fixed in Win32lib or whether there is a work around
but
here is something that will work for MLE's and RichEdits. Good luck!

1st, I really dont understand why you have to jump thru hoops to get the caret
position
but here is how Im doing this presently:

Line = SendMessage(Edit,EM_LINEFROMCHAR,-1,0)
Col  = LOWORD(SendMessage(Edit,EM_GETSEL,0,0)) -
SendMessage(Edit,EM_LINEINDEX,-1,0)

Now this seems to work great!

The first "Line" of the MLE or RichEdit will be 0,  consider the following

"Line #0"   Copyright © 2001 H.W Overman
"Line #1"   email address: euman at bellsouth.net
"Line #2"
"Line #3"   Enter your installation notes here:

and "Col" will be the obvious char position on the current "Line"

Hope this will help someone.

Euman
euman at bellsouth.net

Q: Are we monetarily insane?
A: YES

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu