First page header/footer are visible only after double-click

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Tavo
Posts: 175
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

First page header/footer are visible only after double-click

Post by Tavo »

Hello, I hope my bad English is not so bad. I'm not sure that the title is correct :-)

I am having a problem when I load a document in the header of the first page of a TSRichViewEdit.
The content is not visible at first. You can only see after double clicking on it.

My application is to managing documents and is a bit complex, or difficult to explain, but I'll try to simplify the explanation and maybe you can give me some clue to identify what it is I'm doing wrong.

I have a TSRichViewEdit within a TFrame, its properties are:

Code: Select all

Self.Editor.SRichViewEdit1.RVHeader.ReadOnly: = True; // "Editor" is a TFrame
  Self.Editor.SRichViewEdit1.RVFooter.ReadOnly: = True;

  Self.Editor.SRichViewEdit1.PageProperty.HeaderVisible: = True;
  Self.Editor.SRichViewEdit1.PageProperty.FooterVisible: = True;
  Self.Editor.SRichViewEdit1.BackgroundProperty.Visible: = True;

  Self.Editor.SRichViewEdit1.PageProperty.FacingPages: = False;
  Self.Editor.SRichViewEdit1.PageProperty.TitlePage: = True;

  Self.Editor.SRichViewEdit1.RVFOptions: = [
                           rvfoSaveBinary,
                           rvfoSaveTextStyles,
                           rvfoSaveParaStyles,
                           rvfoSaveDocProperties,
                           rvfoLoadDocProperties
                         ];
The images are stored in another table and are shared by all documents

Code: Select all

Self.Editor.SRichViewEdit1.OnRVFPictureNeeded: = RV_UtilLT.DummySRV.LTPictureNeeded;
I load (only the body) of the document in Self.Editor.SRichViewEdit1.RichViewEdit with something like this

Code: Select all

  rv.Clear;
  TempStream: = TClientBlobStream.Create (Fld, bmRead);
  try
    Result: = rv.LoadRVFFromStream (TempStream);
  Finally
    TempStream.Free;
  End;
I load the subdocument in the header of the first page

Code: Select all

   Self.SRichViewEdit1.SubDocuments [srvhftFirstPageHeader] .Clear;
   LoadRVE_FromFieldCDS (
                         Self.SRichViewEdit1.SubDocuments [srvhftFirstPageHeader],
                         Self.DM_Esc.hfpTextCart
                       ); // HfpTextCart is a TBlobField
Repeat the procedure for

srvhftFirstPageFooter
srvhftNormalFooter
srvhftNormalHeader

The LoadRVE_FromFieldCDS Function is

Code: Select all

Function LoadRVE_FromFieldCDS (rv: TCustomRVData;
                               Fld: TBlobField): Boolean;
var
  TempStream: TClientBlobStream;
  Color: Tcolor;
begin

  TempStream: = TClientBlobStream.Create (Fld, bmRead);
  try
    Result: = rv.LoadRVFFromStream (TempStream, Color, nil, nil, nil, nil);
  Finally
    TempStream.Free;
  End;

end;
The symptom, or final behavior is:

Subdocuments of the first page are not seen, nor their text and your pictures
Subdocuments of the following pages (srvhftNormalFooter and srvhftNormalHeader) can be partially seen: its height is not correct until double-click.
Subdocuments of the first page appear only when I double-click the header or footer of the first page.

Another very similiar use Form behaves correctly (subdocuments shows correctly in the first page), the same TFrame. But I cannot to realize what is the difference, what I do wrong. My project (my application) is large and complex and it is very difficult to isolate the conditions to reproduce the problem in another project. Maybe you can give me some idea. If you need me to give them more information about my problem I will
I appreciate any clue that they can give.

Thanks for readme
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you call SRichViewEdit1.Format after loading these documents/subdocuments?

Also, if you create SRichViewEdit1 in code, call SRichViewEdit1.Loaded after its creation.
Tavo
Posts: 175
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

Post by Tavo »

Sergey, thanks for answering.

I'm not creating SRichViewEdit1 by code. Anyway, after your answer, I tried to call Loaded() but does not solve the problem.
Yes, I call format after loading the subdocuments. I even put a button that execute the following code

Code: Select all

  Application.ProcessMessages ;

  Self.Editor.SRichViewEdit1.PageProperty.HeaderVisible := True ;
  Self.Editor.SRichViewEdit1.PageProperty.FooterVisible := True ;
  Self.Editor.SRichViewEdit1.BackgroundProperty.Visible := True ;

  Self.Editor.SRichViewEdit1.Loaded ;
  Self.Editor.SRichViewEdit1.RichViewEdit.Format ;

but the header of the first page is still not visible. So,
1) I double-click on the header of the first page, the header appears (with shared images). No foot appears.
2) Then I scroll down toward the footer of the first page, I make double-click on the footer, then the page scroll up but the foot is still not visible.
3) I change the Zoom until the entire page is visible. I'm then double click on the bottom of the first page. The foot becomes visible.

I do not understand what I'm doing wrong. As I explained, my application is complex, since I store the bodies of documents (without their images) in a table, headers in another table, footers in another table, and images (the body, header and footer) in another table.

Within the same application, I have another form that works properly. That's why I'm sure something I'm doing wrong. Maybe I'm missing something or changing the order of function calls.
But I'm a little disoriented and do not know where to look.

Thanks for readme

..- .
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do not call SRichViewEdit1.RichViewEdit.Format, call SRichViewEdit1.Format ;
Tavo
Posts: 175
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

Post by Tavo »

As always, Sergey, you're right !!!!!
Sorry for the inconvenience and thank you very much.
Salute from Buenos Aires
haidomingo
Posts: 16
Joined: Tue Nov 10, 2009 7:27 pm

Re: First page header/footer are visible only after double-click

Post by haidomingo »

I have the opposite effect when double-click on the header/footer (double click hide header/footer).
my code for disable headr footer (unit pagetools):

Code: Select all

procedure TScEditor.SRichViewEdit1ChangeActiveEditor(Sender: TSRichViewEdit;
  ActiveEditor: TRichViewEdit);
begin
  if (ActiveEditor=Sender.RVHeader) or (ActiveEditor=Sender.RVFooter) then
      Sender.StartEditing(srvrveMain)
end;
e header creation:

Code: Select all

procedure CreaPaginaDocumento;
begin
  ScEditor.SRichViewEdit1.RichViewEdit.DocParameters.LeftMargin:=1.4;
  ScEditor.SRichViewEdit1.RichViewEdit.DocParameters.RightMargin:=1.4;
  ScEditor.SRichViewEdit1.RichViewEdit.DocParameters.TopMargin:=3.5;
  ScEditor.SRichViewEdit1.RichViewEdit.DocParameters.BottomMargin:=1.00;
  CreaHeader;
  CreaCorpo;
end;

procedure TabellaHeaderSmall;
begin
    with ScEditor do begin
      TabellaHeader.Cells[0,0].BestHeight := 1;
      TabellaHeader.Cells[0,0].BestWidth := 1;
      TabellaHeader.Cells[0,1].BestHeight := 1;
    end;
end;

procedure CreaHeader;
var
  Pic  : TPngImage;
  r,c  : integer;
begin
  ScEditor.SRichViewEdit1.RichViewEdit.DocParameters.HeaderY:=0.8;
  ScEditor.TabellaHeader:= TRVTableItemInfo.CreateEx(1, 2,ScEditor.SRichViewEdit1.RVHeader.RVData);
  ScEditor.TabellaHeader.CellHSpacing := 0;
  ScEditor.TabellaHeader.CellVSpacing := 0;
  ScEditor.TabellaHeader.Options := ScEditor.TabellaHeader.Options - [rvtoRowSizing, rvtoColSizing];
  ScEditor.TabellaHeader.BorderWidth := 0;
  ScEditor.TabellaHeader.CellBorderWidth := 0;
  ScEditor.TabellaHeader.OnCellEditing := ScEditor.OnCellEditingH;
  for r := 0 to ScEditor.TabellaHeader.Rows.Count - 1 do
    for c := 0 to ScEditor.TabellaHeader.Rows[r].Count - 1 do
      ScEditor.TabellaHeader.Cells[r, c].Clear;
  ScEditor.TabellaHeader.Cells[0, 1].AddNL('xxx', 0, 0);
  ScEditor.TabellaHeader.Cells[0, 1].AddNL('xxx', 1, 0);
  ScEditor.TabellaHeader.Cells[0, 1].AddNL('xxxxxx', 2, 0);
  Pic := TPngImage.Create;
  pic.LoadFromFile('D:\Embarcadero\Projects\DocEditor\WORK\logo.png');
  ScEditor.TabellaHeader.Cells[0,0].AddPictureEx('logo', pic, 0, rvvaMiddle);
  ScEditor.SRichViewEdit1.RVHeader.InsertItem('Header', ScEditor.TabellaHeader);
  TabellaHeaderSmall;
  ScEditor.SRichViewEdit1.RVHeader.ReadOnly:= True;
  ScEditor.SRichViewEdit1.PageProperty.HeaderVisible:= True;
  ScEditor.SRichViewEdit1.Reformat;
end;

procedure CreaCorpo;
var
  r,c  : integer;
begin
  ScEditor.TabellaHeader:= TRVTableItemInfo.CreateEx(1, 2,ScEditor.SRichViewEdit1.RVHeader.RVData);
  ScEditor.TabellaHeader.CellHSpacing := 0;
  ScEditor.TabellaHeader.CellVSpacing := 0;
  ....
 
and I call them from (mainform)

Code: Select all

procedure TScEditor.TBItem5Click(Sender: TObject);
begin
  SRichViewEdit1.RichViewEdit.CurTextStyleNo:=4;
  SRichViewEdit1.RichViewEdit.CurParaStyleNo:=0;
  SRichViewEdit1.RichViewEdit.InsertText(#13,false);
  CreaPaginaDocumento;
  SRichViewEdit1.RichViewEdit.CurTextStyleNo:=4;
  SRichViewEdit1.RichViewEdit.CurParaStyleNo:=0;
  SRichViewEdit1.RichViewEdit.InsertText(#13,false);
 // SRichViewEdit1.Format;
end;
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: First page header/footer are visible only after double-click

Post by Sergey Tkachenko »

What is this opposite effect?
haidomingo
Posts: 16
Joined: Tue Nov 10, 2009 7:27 pm

Re: First page header/footer are visible only after double-click

Post by haidomingo »

The header is show correctly But when double click in the header it disappears
haidomingo
Posts: 16
Joined: Tue Nov 10, 2009 7:27 pm

Re: First page header/footer are visible only after double-click

Post by haidomingo »

haidomingo wrote: Sat May 06, 2017 9:23 pm The header is show correctly But when double click in the header it disappears

I had forgotten to call before
StartEditing(srvrveHeader);
Post Reply