Page 1 of 1

Compiler problem with OnDrawBorder

Posted: Fri Jan 27, 2012 2:29 pm
by jwinkl
I've got a problem with compiling the following code:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RVStyle, RVScroll, RichView, RVEdit, RVTable;

type
  TForm1 = class(TForm)
    RVEd: TRichViewEdit;
    RVStyle: TRVStyle;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
procedure DrawBorder(Sender: TRVTableItemInfo; Canvas: TCanvas;
  Left, Top, Right, Bottom, Width: Integer; LightColor, Color,
  BackgroundColor: TColor; Style: TRVTableBorderStyle; Printing: Boolean;
  VisibleBorders: TRVBooleanRect; Row, Col: Integer; var DoDefault: Boolean);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.FormCreate(Sender: TObject);
var T: TRVTableItemInfo;
begin
  T := TRVTableItemInfo.CreateEx(2, 2, RVEd.RVData);
  T.SetCellVisibleBorders (False, True, True, True, 0, 0);
  T.OnDrawBorder := DrawBorder;
  RVEd.InsertItem ('', T); RVEd.Format;
end;

procedure TForm1.DrawBorder(Sender: TRVTableItemInfo; Canvas: TCanvas;
  Left, Top, Right, Bottom, Width: Integer; LightColor, Color,
  BackgroundColor: TColor; Style: TRVTableBorderStyle; Printing: Boolean;
  VisibleBorders: TRVBooleanRect; Row, Col: Integer; var DoDefault: Boolean);
begin
  if Width=0 then
    exit;
  inc(Right);
  inc(Bottom);
  Canvas.Pen.Color := Color;
  Canvas.Pen.Style := psInsideFrame;
  Canvas.Pen.Width := 1;
  Canvas.Brush.Style := bsClear;
  Canvas.Rectangle(Left,Top,Right,Bottom);
  DoDefault := False;
end;

end.
When I want to compile this in Delphi 7 (TRVEdit version 13.6.2), I get the error message

Incompatible types 'TRVStyleLength' and 'Integer'

in line 36, i.e. "T.OnDrawBorder := DrawBorder;"

As I'm completely at a loss about why this happens or what it means, I would like to ask for help.

Posted: Fri Jan 27, 2012 2:47 pm
by jwinkl
Sorry, but it seems I've just solved the puzzle myself. The parameter "Width" in the DrawBorder procedure must be declared as TRVStyleLength instead of Integer. Funny that the Example in the help file has this bug.