• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

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.SendMessage(EM_GETSCROLLPOS, 0, reinterpret_cast<LPARAM>(&scrollPos));

              //
                //operations to change some content of the edit control
                //

            m_MyRichEditControl.SendMessage(EM_SETSCROLLPOS, 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?


0
ashugarg00
Asked:
ashugarg00
  • 3
  • 2
  • 2
  • +1
1 Solution
 
AndyAinscowCommented:
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?)
0
 
DanRollinsCommented:
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.
0
 
ashugarg00Author Commented:
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DanRollinsCommented:
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?
0
 
ashugarg00Author Commented:
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.
0
 
DanRollinsCommented:
Recommend: Refund / Save in the PAQ
0
 
AndyAinscowCommented:
I concur
0
 
moduloCommented:
Closed, 500 points refunded.
modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now