Mouse Hoover on Fast Report
Dear all,
I'm using FR 2.5,
I want to make a Hoover Line on Fast Report, which it will show when i do some
MouseOver on it (it's like a Hoover Line on DBGrid).
So i already built it with this pseudocode:
var
fr: TfrReport;
fr.OnMouseOverObject := DoMouseOverObject;
procedure TcpReport.DoMouseOverObject(iView: TfrView;
var oCursor: TCursor);
procedure CreateHooverLine;
begin
FHooverLine := TShape.Create(self);
FHooverLine.Brush.Color := $00F9E3F9;
FHooverLine.Brush.Style := bsSolid;
FHooverLine.Pen.Mode := pmMask;
FHooverLine.Pen.Style := psClear;
FHooverLine.Parent := fr.Preview.Window.PaintBox;
end;
begin
if not Assigned(FHooverLine) then CreateHooverLine;
if pos('MEMO', Uppercase(iView.Name)) > 0 then begin
FHooverLine.Left :=
TfrEMFPages(TCpPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.Left;
FHooverLine.Top := iView.y + iView.OffsY;
FHooverLine.Height := iView.dy;
FHooverLine.Width :=
TfrEMFPages(TPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.
Right -
TfrEMFPages(TPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.
Left;
FHooverLine.Visible := True;
fr.Preview.Window.Repaint;
end
else begin
FHooverLine.Visible := False;
end;
end;
It do well, but when i'm dragging the page and replacing again my mouse on it, the Hoover Line didn't place well on the right coordinates, do anybody know how to solved it??
Thanks for ur help,
and sorry for my english
sandy
I'm using FR 2.5,
I want to make a Hoover Line on Fast Report, which it will show when i do some
MouseOver on it (it's like a Hoover Line on DBGrid).
So i already built it with this pseudocode:
var
fr: TfrReport;
fr.OnMouseOverObject := DoMouseOverObject;
procedure TcpReport.DoMouseOverObject(iView: TfrView;
var oCursor: TCursor);
procedure CreateHooverLine;
begin
FHooverLine := TShape.Create(self);
FHooverLine.Brush.Color := $00F9E3F9;
FHooverLine.Brush.Style := bsSolid;
FHooverLine.Pen.Mode := pmMask;
FHooverLine.Pen.Style := psClear;
FHooverLine.Parent := fr.Preview.Window.PaintBox;
end;
begin
if not Assigned(FHooverLine) then CreateHooverLine;
if pos('MEMO', Uppercase(iView.Name)) > 0 then begin
FHooverLine.Left :=
TfrEMFPages(TCpPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.Left;
FHooverLine.Top := iView.y + iView.OffsY;
FHooverLine.Height := iView.dy;
FHooverLine.Width :=
TfrEMFPages(TPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.
Right -
TfrEMFPages(TPBox(FHooverLine.Parent).Preview.EMFPages).Pages[0]^.R.
Left;
FHooverLine.Visible := True;
fr.Preview.Window.Repaint;
end
else begin
FHooverLine.Visible := False;
end;
end;
It do well, but when i'm dragging the page and replacing again my mouse on it, the Hoover Line didn't place well on the right coordinates, do anybody know how to solved it??
Thanks for ur help,
and sorry for my english
sandy
Comments
The previous codes are almost right,
but i forget to rePaint it.
So, i just need to reDraw TPBox object.
TPBox(FHooverLine.Parent).Invalidate;
(with FHooverLine.Parent := fr.Preview.Window.PaintBox )