Page 1 of 1

TCustomRVFormattedData.Item2DrawItem

Posted: Thu Apr 04, 2013 1:36 pm
by Graham
Using our new routine to get the text as displayed from a specified Y position the Item2DrawItem gets called. However this routine seems to fail if the line of text consists of single word that is too long to fit on the line.

Original code:

if (DrawItems.ItemNo<>ItemNo) or
((DrawItems.Offs>=ItemOffs) and not (DrawItems[i-1].Offs+DrawItems[i-1].Length<ItemOffs)) then begin

take out the = and replace with:

if (DrawItems.ItemNo<>ItemNo) or
((DrawItems.Offs>ItemOffs) and not (DrawItems[i-1].Offs+DrawItems[i-1].Length<ItemOffs)) then begin


This seems to fix my problem, but does this have any other undesired effects?
I have sent you some screen shots to show you the problem.

Posted: Thu Apr 04, 2013 3:56 pm
by Sergey Tkachenko
The method is correct, however the function returning the line text is wrong.
We cannot use (ItemNo, OffsetInItem) values to identify a line, because it is possible that this position corresponds to two places on the screen (the end of the line N, and the beginning of the line N+1).
So we must work with drawing items directly. Details are sent by email.