Hello Jean-Marc,

> You have to check that you are in the correct paragraph. pos is the 
> position in the paragraph. The index of the paragraph is "pit" (the same 
> that is passed to RowPainter constructor). Thus the test should be
> 
> if (cur.pos() >0 && cur.pit() == pit)
> 
> This will however not be enough for nested insets, since the cursor 
> could be at the pos character of the paragraph pit, but in _another_ 
> inset. Therefore I would recommend something like
> 
>    if (cur.inTexted() && cur.text() == text_ && cur.pos() >0 && 
> cur.pit() == pit)
> 
> What the extra checks do are
> * test that we are in a text inset (not maths)
> * check whether the Text object is the same as the underlying Text of 
> TextMetrics (this ensures that we are in the right inset).

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)?

Thank you
Hashini




Reply via email to