ashugarg00
asked on
problem with SCROLLPOS in Rich Edit
Hi,
I'm using a rich edit control to make a word processor.
In my code I do the following
POINT scrollPos;
m_MyRichEditControl.SendMe ssage(EM_G ETSCROLLPO S, 0, reinterpret_cast<LPARAM>(& scrollPos) );
//
//operations to change some content of the edit control
//
m_MyRichEditControl.SendMe ssage(EM_S ETSCROLLPO S, 0, reinterpret_cast<LPARAM>(& scrollPos) );
As a result I find the document has scrolled to a different position. And no, I havent changed the value of scrollPos.
Any reason why this happens?
I'm using a rich edit control to make a word processor.
In my code I do the following
POINT scrollPos;
m_MyRichEditControl.SendMe
//
//operations to change some content of the edit control
//
m_MyRichEditControl.SendMe
As a result I find the document has scrolled to a different position. And no, I havent changed the value of scrollPos.
Any reason why this happens?
A guess - is it positioning the scroll pos to the center or top of the visible area? (Do you really require the EM_SETSCROLLPOS message?)
What sort of edit operation did you do? I can concieve of some that would make the original value invalid and thus make the control appear to behave oddly when you reused it.
ASKER
The edit operations are not causing it to change. I did a EM_GETSCROLLPOS and immediately after that did a EM_SETSCROLLPOS, found the scrollPos valu had changed even without any edit operations.
The API documentation indicates that the RTF control *will* adjust the value in some cases. It says the following:
Rich Edit checks the X and Y coordinates and adjusts them if necessary, so
that a complete line is displayed at the top. It also ensures that the text is
never completely scrolled off the view rectangle.
Is that what is happening to you?
Rich Edit checks the X and Y coordinates and adjusts them if necessary, so
that a complete line is displayed at the top. It also ensures that the text is
never completely scrolled off the view rectangle.
Is that what is happening to you?
ASKER
I got the solution to my problem. The problem was in the range of the scroll pos which is 2 bytes i.e 65535. However our file was huge which required a scroll pos beyond the above range.
Recommend: Refund / Save in the PAQ
I concur
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.