To draw a line

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

To draw a line

Post by j&b »

Hello,

I want to draw a line from the left memo border to the right memo border (like a pagebreak but without producing a new page in the print).
The horzline must be independent from font.size.

In RichViewActions I found

{ TrvActionInsertHLine }
constructor TrvActionInsertHLine.Create(AOwner: TComponent);
begin
inherited;
Color := clWindowText;
Width := 1;
FMessageID := rvam_act_InsertHLine;
end;

procedure TrvActionInsertHLine.ExecuteTarget(Target: TObject);
begin
GetControl(Target).InsertBreak(Width, rvbsLine, Color);
end;

procedure TrvActionInsertHLine.UpdateTarget(Target: TObject);
var rve: TCustomRichViewEdit;
begin
if not RVA_ActionsEnabled or Disabled then begin
Enabled := False;
exit;
end;
rve := GetControl(Target).TopLevelEditor;
Enabled := {not rve.ReadOnly and} (rve.RVData.PartialSelectedItem=nil);
end;



but I can't change code so that it runs.

Who has an idea ?

Jürgen
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This action inserts "break" - horizintal line.
It may be solid, dotted or dashed line or rectangle. You can change its width from 1 to 5. But its does not depend on font size.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

In the meantime I have found my error.

In my trials I always write rve.InsertBreak(1, rvbsLine, clBlack);

but I must use the name of my rve-memo:

procedure TForm1.sbStrichClick(Sender: TObject);
begin // found in your support-forum
memo.InsertBreak(1, rvbsLine, clBlack);
if memo.TopLevelEditor.CurItemNo=memo.TopLevelEditor.ItemCount-1 then
SendMessage(memo.TopLevelEditor.Handle, WM_KEYDOWN, VK_RETURN,0)
else SendMessage(memo.TopLevelEditor.Handle, WM_KEYDOWN, VK_RIGHT,0);
end;

Now it runs.

I often don't know for which keyword I have to search. So I did not come on the idea that a BREAK (INSERTBREAK) means the inserting of a line (but it is a breaking of a text).

Jürgen
Last edited by j&b on Thu Aug 16, 2007 2:48 pm, edited 1 time in total.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, probably some terms should be changed, but they were used since the first version (and even before), so it's hard to change them...
Post Reply