TWPManageHeaderFooter

  • I've been using this dialog for users to add and edit headers and footers in my templates because it is fairly easy for them to use. I've got it renamed to TWPManHeadFoot for WPT5 and it loads up and everything but when I add new headers, nothing gets added to the document. Is there a demo for this or more information?

  • That's what I have now.

    But when I add a header using that dialog, nothing is created on the document. If I dbl click the header entry in the dialog list, nothing happens. So I can never enter any text into the header. No header appears to be on the document, even though it is in the dialog list.

    It also gets an av when you try to delete an old header. More on that later.

  • ok I tried it in layout and fulllayout. Problem seems to be on headers other than ones that includes the first page(in this case because my document is one page). So allpages works, but notonfirstorlast does not.

    On a one page document, these work,
    allpages
    firstpageonly
    oddpages

    on a two page document, the above work, plus
    evenpages
    lastpageonly

    notonfirstorlast only appears to work if the document contains 3 pages or more.

    With the headers I can enter, I get the blue outline like I'd expect.

    My users will almost always use notonfirstorlast and lastpageonly together, so this won't work at all right now. The problem is that their template is almost always only one page, but the finished docuement could be several pages long.

    When deleting headers, it throws an exception if you delete a header that is visible on the screen. Doesn't seem to do it on the allpages header. The exception is in WPCTRMemo in the Paint function line is (if assigned(FONPaint) then FONPaint(Self));

    Also, is there some setting that makes the cursor appear to the left of the last character typed? It's doing this for some reason and I need it back on the right side, trailing the last character entered.

  • ok, more on this.

    You no longer get AVs when deleting headers. yeah!

    You can now add any header to the document regardless of how many pages it is.

    Should headers coexist or does one override the other?
    If I put a 'firstpage' header in, and then add an 'oddpage' header. I can only edit the 'firstpage' header. Is that normal? There is an exception to this that I'll get to in a minute.

    Currently, if you have a one page document open, you can add headers for 'notonfirstorlast' and 'lastpageonly', but you cannot edit them.

    On a one page document, if you add the 'oddpage' header by itself, you can edit it. If you now add the 'firstpageonly' header, you can edit it, but can no longer edit the 'oddpage' header and the oddpage header doesn't print. Does the same with the 'allpages' header. 'FirstPageonly' overrides them completely.

    on the dialog, what are the two big button that change the layout?

    Even though you can add any header to a one page document, you still cannot edit them if they do not apply to the current document. So if you have a one page document, you can create a 'lastpage' header, but you can never edit it. BUT, if you click the right hand button on the dialog, you can type and whatever you type ends up in that header if you later increase the size of the document long enough so that it would include the header you edited. Problem is that you can't 'see' what you type. I had a one page document with a last page only header, I clicked that big right button with the header selected and it looked like it cleard the screen, I typed a couple letters without it appearing to do anything. Then I hit the big left button and the body text came back into view. I now go into the body and do a bunch of line feeds to create the second page, and voila, the letters I typed into nowhere are there. So it's like that right button should enable you to edit headers if they aren't on the current page, but the problem is you can't see what you are typing. It seems it wants to work like the old version when you would edit each header.

    There was one other time I was able to get into a 'mode' that seemed to work like the old version where if you clicked on a header, it would show a blank editor you could type into. I can't figure out how I did it now though.

    Lastly, are there any issues working with documents that have headers created with 4.22?


    whew, hope all this makes some sense.

    • Offizieller Beitrag

    >>There was one other time I was able to get into a 'mode' that seemed to work like the old version where if you clicked on a header, it would show a blank editor you could type into. I can't figure out how I did it now though. <<

    Did you click on the big buttons?

    They change the mode, one is the page layout mode the other the normal mode.

    Only in normal mode you can edit headers which are not visible otherwise (i.e. since your document is too short) - I hope this answers your question.

    >>Lastly, are there any issues working with documents that have headers created with 4.22? <<

    No. It should read those and also headers created in Word.

    Julian Ziersch

  • ok yes that helps, especially after I went in and turned the hints on :)

    However, there's something up with the editor. When you switch to Normal mode, the screen is all blank. If you hit return a few times you will see it come on the screen. I did this one using the addict demo and just adding the basic code for the manheadfoot dlg. Open the dialog, click the footer, click edit mode and this is what shows. If nothing happens to be in the footer already, it's just a totally blank canvas, no white area and no text. However, if you type here, even though you can't see it, it goes into whatever header/footer you have selected, and if you type enough lines, it will start to show up on the screen. I guess that is because of PageGap mode? Can another layout be used instead? As you can see here, there is a sliver of white at the top, if you start hitting enter, it will get bigger as the lines fill in.


    and what about having multiple headers on the same page.

    like if you have firstpageonly, and allpages, will they both show on the first page? Or is that outside rtf standards?

    Einmal editiert, zuletzt von Bobby (13. September 2004 um 15:03)

    • Offizieller Beitrag

    Hi,

    Yes, I have seen the display you showed on the image. It has to do with the normal/pagegap mode and is a bug. ´

    >> and what about having multiple headers on the same page.
    WPTools Standard will not do this. "Premium", maybe.


    >>like if you have firstpageonly, and allpages, will they both show on the first page? Or is that outside rtf standards?<<

    RTF only has 1, odd an even.

    Maybe you should look into the event OnGetSpecialText - you can controll very precisely which header or footer to show on a page.

    Julian

  • I made this change to the WPManHeadFoot pas and it seems to work ok for me. I changed wplayPageGap to wplayFullLayout. I also added the refresh so it will show the header immediately. Do you think there is any problem doing it this way?

    Code
    procedure TWPManageHeaderFooter.PageLayoutModeClick(Sender: TObject);var currrtfdata : TWPRTFDataBlock;begin   currrtfdata := WPRichText.CursorOnText;   if PageLayoutMode.Down then   begin      if (WPRichText.LayoutMode in [wplayNormal,          wpWordWrapView, wplayShowManualPageBreaks,          wplayPageGap, wplayExtendedPageGap, wplayShrunkenLayout]) and          (WPRichText.DisplayedText<>nil) and          (WPRichText.DisplayedText.Kind<>wpIsBody) then             WPRichText.DisplayedText :=WPRichText.BodyText;      WPRichText.LayoutMode := wplayFullLayout;   end else   begin      if not (WPRichText.LayoutMode in [wplayNormal,          wpWordWrapView, wplayShowManualPageBreaks,          wplayPageGap, wplayExtendedPageGap, wplayShrunkenLayout]) then      begin         WPRichText.DisplayedText := currrtfdata;      end;      //WPRichText.LayoutMode := wplayPageGap; //***changed to fullLayout      WPRichText.LayoutMode := wplayFullLayout;      WPRichText.Refresh(False);   end;   WPRichText.ShowCursor;   WPRichText.SetFocus;end;

    I also changed the close button a little so it would go back to the body when you exit the dialog if you were editing a header that doesn't appear in the current document. Maybe you have a better way than this to do it?

    Code
    procedure TWPManageHeaderFooter.CloseButtonClick(Sender: TObject);
    begin
      AllHeaderFooter.ItemIndex := -1;
      WPRichText.DisplayedText := WPRichText.BodyText;
      WPRichText.CursorOnText := WPRichText.DisplayedText;
      WPRichText.ShowCursor;
      WPRichText.SetFocus;
      Close;
    end;

    You probably have better ways. This seems to work, but I don't always write the best code :(


    Let me know if this is ok. Thanks.

  • it would be great if it could automatically switch between views depending on whether the header you click in the dialog should appear in the current document or not.

    For example, if you have a one page document, and you click on firstpageonly header, it shows in the layout mode(left button) but if you click notonfirstorlastpages, it would switch to normal mode(right button)

    But I don't know how to do that.