HELP margin and image insertion

General TRichView support forum. Please post your questions here
Post Reply
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

HELP margin and image insertion

Post by KFC123 »

Hi there,
I am going to insert text on the left margin at specified row. I have searched the demo and find the following way to do that

procedure TForm1.RVStyle1DrawCheckpoint(Sender: TRVStyle; Canvas: TCanvas;
X, Y, ItemNo, XShift: Integer; RaiseEvent: Boolean; Control: TControl;
var DoDefault: Boolean);
begin
if RaiseEvent then
Canvas.Pen.Color := Sender.CheckpointEvColor
else
Canvas.Pen.Color := Sender.CheckpointColor;
Canvas.TextOut( ... );
DoDefault := False;
end;

However, in this case, the text is drawn as a graphics rather than a pure text. Any straightforward way to show text (a single letter in my case) in margin as a pure text?

By the way, I would like to show several imaged buttons on the richview (not richviewedit). I try to use richview.InsertControl to so do, but seems not ok. Would you please show me a piece of code to do

1) Insert an imaged button at current position in the content of richview and have a function to response button's click

2) Insert an imaged button at the RIGHT margin located at the same row of the current position and have a function to response button's click. In my case, more than one imaged-button is inserted at the margin space. Is it possible to have such buttons scoll when the richview is scrolled vertically?

Again, I found it is not allowed to clear RichView within MouseUp Event. Firstly, I add a table to the RichView and response to the MouseUp Event, if one click the specified row of the table then clear the RichView, including the table itself, and add something new to the richview???

Thanks in advance.
Last edited by KFC123 on Wed Nov 08, 2006 2:33 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 »

Sorry, I am not sure that I understand your questions.
First, what do you mean by " the text is drawn as a graphics rather than a pure text"?
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

Post by KFC123 »

Sorry for the misleading question. Anyway, just forget the first question. Would you please give me some idea about the rest questions?

I would like to show several imaged buttons on the richview (not richviewedit). I try to use richview.InsertControl to so do, but seems not ok. Would you please show me a piece of code to do

1) Insert an imaged button at current position in the content of richview and have a function to response button's click

2) Insert an imaged button at the RIGHT margin located at the same row of the current position and have a function to response button's click. In my case, more than one imaged-button is inserted at the margin space. Is it possible to have such buttons scoll when the richview is scrolled vertically?

Again, I found it will crash when clearing RichView within MouseUp Event. Firstly, I add a table to the RichView and response to the MouseUp Event. I have a piece of code to clear the RichView, including the table itself, when one click the specified row of the table???

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

Post by Sergey Tkachenko »

First, why controls are not ok?
Instead of controls, you can use images. For example, hypertext images ("hot-picture" or "hotspot")

InsertControl inserts control in the position of caret. For hypertext pictures, use InsertHotPicture or InsertHotspot.
TRichView does not have caret, so (of course) it does not have methods for insertion in the position of caret. It has Add*** methods adding items to the end of document.
For aligning items to the right, you can use tables.

As for problems in clearing in OnMouseUp... What version of TRichView do you use?
Post Reply