Page 1 of 1

Why don't you make the DoConvertRVtoSRV visible?

Posted: Sat Jul 28, 2012 5:22 pm
by vit
Hi!

Have you tried to create application like \srv_demos\Demos\CustomDraw\Rectangles\DrawAll, but wich also draws rectangles when either RVHeader or RVFooter is edited?

Try to replace SRichViewEdit1.RichViewEdit.RVData by SRichViewEdit1.ActiveEditor.RVData and enter some text into RVHEader. You'll see that coordinates of rectangles are converted relative to SRichViewEdit1.RichViewEdit, not SRichViewEdit1.RVHeader.

Public method ConvertRVtoSRV uses DoConvertRVToSRV which receives TCustomRichViewEdit as parameter.

Now I have to do this:

Code: Select all

type
  TSRVEAccess = class(TSRichViewEdit);
***

Code: Select all

  if FSRVE.ActiveEditor.GetItemCoordsEx(RVData, ItemNo, PartNo, True, Rect) then
  begin
    TSRVEAccess(FSRVE).DoConvertRVtoSRV(Rect.TopLeft, FSRVE.RVHeader,
      Rect.TopLeft, PageNoStub, False);
    TSRVEAccess(FSRVE).DoConvertRVtoSRV(Rect.BottomRight, FSRVE.RVHeader,
      Rect.BottomRight, PageNoStub, False);
    Result := True;
  end
  else
    Result := False;
And it work's fine

Posted: Sat Jul 28, 2012 7:06 pm
by Sergey Tkachenko
Would it be ok if we add an optional Editor parameter in ConvertRVToSRV? If it is omitted, the method would use ActiveEditor

Posted: Sat Jul 28, 2012 7:18 pm
by vit
Yes, it would be OK.