Page 1 of 1

To draw a line

Posted: Thu Aug 16, 2007 11:06 am
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

Posted: Thu Aug 16, 2007 11:09 am
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.

Posted: Thu Aug 16, 2007 11:48 am
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

Posted: Thu Aug 16, 2007 2:05 pm
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...