trichview.com

trichview.support




Re: analysing paragraphs


Return to index


Author

Message

Sergey Tkachenko

Posted: 10/31/2003 14:41:54


> No matter, thanks anyway.

> Yes, I meant an empty text item.


You can iterate all items from 0 to rv.ItemCount-1, check if they are text

items (rv.GetItemStyle(i)>=0), if they start a paragraph

(rv.IsParaStart(i)), get their text (rv.GetItemTextA(i)) and paragraph style

(rv.GetItemPara(i)).


> I just now wonder why this code (shows item id on mouse move):


X,Y in OnMouseMove are client coordinates (relative to the top left corner

of the component window).

GetItemAt requires the coordinates in document (relative to the top left

corner of the scrollable area).

I added two lines of code converting coordinates at the beginning of your

event code:


procedure TfrmMain.RVEditAMouseMove(Sender: TObject; Shift: TShiftState; X,

  Y: Integer);

  var Msg : string;

      ARVData : TCustomRVFormattedData;

      AItemNo, Offs, St : integer;

begin

  inc(X, RVEditA.HScrollPos);

  inc(Y, RVEditA.VScrollPos*RVEditA.VSmallStep);

  msg := Format ( 'Pozicija: %d, %d ', [X, Y] );

  StatusBar1.Panels[0].Text := Msg;

  St := -1;

  RVEditA.GetItemAt(X,Y, ARVData, AItemNo, Offs, True);

  if (AItemNo>-1) then St := RVEditA.GetItemStyle(AItemNo);

  StatusBar1.Panels[1].TExt := Format ('It: %d, St: %d, Offs: %d', [AItemNo,

St, Offs] );

end;





Powered by ABC Amber Outlook Express Converter