Hello Jean-Marc, > I tested what you have given and that helped me to understand more. Today I > did more testing and realized that cur.pos() is not related with pixels and > this approach cannot be used as a generic solution. > > Problems: > *I checked the cur.pos() values inside a tabular inset and it always remains > at 0. > *Also the position given in the screen, by a particular cur.pos() varies > according to the selected font size. Am I correct? > *As cur.pos() is just a increment that shows how far the cursor is from the > left most point of an inset; but not from the edge of the screen. > > Is there any good attribute that we can use to compare; which can imply an > absolute position in the screen (may be in pixels)? >
Above problem was able to solve with the use of cur.targetX() and bv.workWidth() as follows. Now the whole page slides as expected if we move the cursor along a too wide Math inset. But the cursor gets disappear after passing the right edge of the screen. I tried to fix it by using cur.setTargetX(int); but failed. Although the cursor target can change numerically, it is not changing graphically. int inc_x=x; int cur_x=cur.targetX(); //current x position of the cursor BufferView & bv = cur.bv(); int const maxwidth = bv.workWidth(); cout << cur.pos() << " " << cur_x << " " << maxwidth << endl ; if (cur_x >= maxwidth) { inc_x-=(cur_x-maxwidth); } RowPainter rp(pi, *text_, pit, row, bidi, inc_x, y);