I have an question about TRichViewEdit

General TRichView support forum. Please post your questions here
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

I have an question about TRichViewEdit

Post by mariana »

Can I draw circles, ellipses, lines or arrows in RichViewEdit?
I mean like in Word or Paint.
Can you help me please?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, you can only insert pictures (TBitmap, TMetafile or other, inherited from TGraphic) or Delphi controls in text.
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

I have an project were in RichViewEdit I need to insert another RichViewEdit and write something in it. It's ok, it works, but when I save file the text writed in inserted control(RichViewEdit) don't save.What can I do to save text? Or can I save text from inserted controls?

And another question..
If I want to save file without text, only controls inserted how can I do that?
10x.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) In order to load RVF file containing controls, you need to register them with RegisterClasses. For example, if you use TButton and TEdit in document, call:
RegisterClasses([TButton, TEdit]);
Do it one time before the first loading.

2) Sorry, I do not understand the second question. Do you want to remove all text from document?
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

Yes, I want to remove all text from document but my inserted controls to remain in initial position.
What you know, can I do that?

thankyou very much
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This procedure deletes all text items from document:

Code: Select all

uses CRVData, RVTable, RVNormalize;
procedure DeleteText(RVData: TCustomRVData);
var i,r,c: Integer;
  table: TRVTableItemInfo;
begin
  for i := RVData.ItemCount-1 downto 0 do
    if (RVData.GetItemStyle(i)>=0) or (RVData.GetItemStyle(i)=rvsTab) then // text or tabulation
      RVData.DeleteItem(i)
    else if RVData.GetItemStyle(i)=rvsTable then begin
      table := TRVTableItemInfo(RVData.GetItem(i));
      for r := 0 to table.RowCount-1 do
        for c := 0 to table.ColCount-1 do
          if table.Cells[r,c]<>nil then
            DeleteText(table.Cells[r,c].GetRVData);
    end;
end;
Call:

Code: Select all

  RichViewEdit1.ClearUndo;
  DeleteText(RichViewEdit1.RVData);
  NormalizeRichView(RichViewEdit1.RVData);
  RichViewEdit1.Format;
RVNormalize is unit from RichViewActions (it can be used even if you do not use RichViewActions)
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

Thankyou very much for helping me..
It worked, but I have a little problem, I don't know how to save coordinates of inserted controls to remain where I introduced them, when deleting text the controls moves at the begin of line and I want to remain where I introduced them.
Have you an idea what can I do?
10x
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In TRichView, controls are positioned in text, and if you remove text, controls will be moved.
Can you explain what do you want to implement, may be I will be able to suggest a solution.
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

I want to create a mask for create pages for printing, and save that page without text so that next time I want to create an page to insert the mask and write text into control.
I use inserted RichViewEdit to write text near an image introduced(to have near image more lines )
Like in next pothos:
Image
Here is when I create the page..
Image
Here is how i want to look after saveing.

Have you understand what I want to do?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I am afraid it's not possible. It requires positioning items at the specified coordinates (unsupported by TRichView)
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

Ok.
Thankyou very much, again.
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

I tried to introduce an PaintBox in RichViewEdit, but at preview time I couldn't see it and neither what is drawn in it.
Know you what can I do to view them, or it is impossible to do that?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If some components are not printed, you can help TRichView to print them.
Process TRVPrint.OnPrintComponent event. In this event, if the component is TPaintBox, create a bitmap (having the same size as the paint box) and draw the paint box on it.
If you need further help, let me know.
mariana
Posts: 16
Joined: Fri Oct 05, 2007 12:17 pm
Location: Sibiu,Romania

Post by mariana »

Hi.. thanks for your help
I have another question..
I introduced an RichViewEdit into another RichViewEdit and save the file with extension rvf, but when I load into aplication the text writed inti the inserted RichViewEdit isn't loaded.. I think that wasn't saved.
What can I do to save text in inserted RichViewEdit?
I registered class in constructor whit function RegisterClasses..

Thank you..
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's not so simple to insert RichViewEdit in RichViewEdit, because:
- it has link to TRVStyle, and links are not saved in RVF;
- it does not save its document together with its properties.
This demo shows how to solve these problems: http://www.trichview.com/forums/viewtopic.php?t=2199
Post Reply