could anyone suggest a way of making a character from point proc? sort of like the EM_CHARFROMPOS message. this has been the biggest problem i've had with my edit control, so far. i'm completely stumped.
Posted on 2001-06-29 13:08:00 by Sloat
is this a richedit or a normal edit control you're talking about?
Posted on 2001-06-29 13:34:00 by Hiroshimator
neither, it's a custom one. i use a linked list to keep track of the lines. each one has a pointer to a string and a rect structure, as well as some other stuff. i can get the line number by using the PtInRect function, but i don't know how to get the character at that point.
Posted on 2001-06-29 14:29:00 by Sloat
you could use GetTextExtentExPoint - call it with the whole line and the X value you got from the point, and it'll give you the number of chars that fit inside that space (lpnFit). the char right after the last char that fits is the one in the point (i think :D)
Posted on 2001-06-30 04:44:00 by fresh
Thanks, it works a little better than GetTextExtentPoint32. it's still coming out wrong sometimes though.
Posted on 2001-06-30 17:33:00 by Sloat
There is some C source on edit controls at www.codeproject.com. Their "Crystal" control can examine characters at or near the cursor.
Posted on 2001-07-01 02:45:00 by Larry Hammick