Beiträge von ehimmer

    If the WPRichText begins with a table and a bookmark is added, the bookmark text added with InputString is visible in the first cell. If the first paragraph is NOT a table, it stays hidden (Yes, BookmarkTextAttr.Hidden is true)

    Code used to add the bookmark:

    Code
    with wp do
      begin
        CPPosition := 0;
        BookmarkInput( '_Toc_' + 'test', true );
        ActiveParagraph.ASet(WPAT_ParIsOutline,2);
        InputString( 'Added bookmark' );
      end;

    WPTools 5.20.6
    Delphi 7

    I emailed you an example program.

    New info:
    1. Noticed the bookmark is not even added if trying to add to a table at CPPosition = 0
    2. Issueing a few CPMoveNext's and then adding the bookmark works

    I second that request!

    But this might help in the meantime... as per Julian's hint from a recent post, I disabled the wpTABMovesToNextField option, and did it myself in the KeyDown event:

    Code
    if Key = VK_TAB then
        begin
          Key := 0;
          if ssShift in Shift then
            WPRichText_Cmt.MoveToPreviousField(false)
          else
            WPRichText_Cmt.MoveToNextField(false);
          WPRichText_Cmt.Refresh();
        end;

    If you have a table in a WPRichText, and some text after the table and save using SaveToFile and then LoadFromFile, you will see that an empty paragraph has been appended. Do this several times, and you end up with a lot of empty paragraphs at the end of your document.

    1. Create a 2x2 table
    2. Add a line of text after the table
    3. SaveToFile
    4. LoadFromFile... notice the extra empty paragraph.

    Note that if there is at least one empty paragraph between the table and the text, then there is no problem. It is only a problem if there is text immediately after the table.

    WPTools 5.20.6
    Delphi 7

    P.S. I emailed you a demo

    Nope, 5.20.6 doesn't work properly in setting a numbered list.

    For example:

    one
    two
    three

    abcde

    four
    five
    six

    Now, select lines "four, five, six", click the numbered list toolbar button several times. With the first click you get each item numbered with "1." not 1, 2, 3. Click again and it doesn't remove the numbered list but rather just indents further.

    When I'm in field entry mode (ppAllExceptForEditFields), I really really really need to prevent the text cursor from repositioning itself to another edit field when the users clicks the mouse UNLESS the user clicks on an edit field itself (and then the cursor should move to that edit field as it does now).

    How can that be accomplished???

    Basically ignore mouse events if the mouse down position is not within an edit field.

    WPTools 5.20.5
    Delphi 7

    Try this:

    Insert a field using InputEditField, set the font to Arial 11pt, and a character background of anything, like light gray or yellow.

    Keyin some random chars inbetween the field markers... notice that the right edge of the characters that have color background get chopped off.

    Do the same thing outside of those field markers, and it looks great.

    WPTools 5.20.5
    Delphi 7

    This came up with WPTools 4 I think, but I can't find the answer on any of the current forums (or I used the wrong search words)...

    Is there a way in WPTools5 to prevent the text cursor from moving when you rightclick the mouse?

    I tend to position the cursor where I want to insert something from a pop up menu, but the cursor moves to where I rightclicked... and yup, the insertion doesn't end up where I wanted it to be.

    Three questions:

    1. I know tab and CTRL+Tab moves forward and backwards through the different edit fields, but isn't the normal backtab a Shift+Tab? For example, a regular Windows form uses Tab and Shift+Tab to move fwd and backwards through the different fields, so wouldn't it be confusing for a user trying to navigate in a WPRichText when in form mode?

    1. when moving backwards, the cursor can sometimes be placed at the last char... how do I move it to the first char of a field in the OnEditFieldFocus event?

    3. It is not explained in the help file, but what is: EditOptions.wpTabToEditFields, and how does it relate to EditOptionsEx.wpTABMovesToNextEditField. I know what the latter does, but what does the other one do?

    Thanks!

    Even with ppAllExceptForEditFields set, I can easily move the text cursor outside of an edit field by using the up cursor movement which freely moves the text cursor to the previous line, and then I am outside of an edit field and then can click or cursor anywhere and the cursor goes there.

    It sometimes does restrict the cursor, but moving the cursor to various points in the field can get it to move outside a field rather easily using the up cursor key.

    WPTools 5.20.5
    Delphi 7

    What is the easiest way to frame each page of a document that will appear in printed output and in a PDF export? What I mean by "frame" is simply a singe line border that is drawn around the whole page, maybe using the page's margins as the location of the frame. Much like the View option, but for printing.

    To sum up, I'd love to have the same functionality as the "Page Border" in Microsoft Word.

    Thanks for any and all suggestions!

    Well, then that there lies the problem. I do the DeleteMarkedChar at the end, and this is where the chars get dropped. And they get dropped only when I have bookmarks at the beginning of that paragraph.

    So please look at how you deal with DeleteMarkedChars when a bookmark is in place. Now that I've narrowed it down, I might be able to create a sample that demos the issue if needed.

    Did you also see the issue about appending using AsString vs AsANSIString('WPTOOLS') as to AsString looses the last paragraph's formatting such as tabstops, justification, and paragraph borders?

    More info:

    I traced it down to a particular function: DeleteMarkedChar

    What I do after generating the report is to delete various text objects like special hyperlinks that I don't want to be hyperlinks in a PDF doc for example (I use hyperlinks for checkboxes, so I don't want the PDF to indicate that checkboxes are hyperlinked).

    After freeing all the start and end objects, I call DeleteMarkedChar to delete the object placeholders themselves.

    But since I explicitly free the objects rather than simply doing the "unlink", do I really need to call DeleteMarkedChar? If I comment out the DeleteMarkedChar, I don't lose those chars that I mentioned at the start of this thread.

    Even so, I wouldn't think DeleteMarkedChar should do what it is doing. Apparently having bookmarks caused DeleteMarkedChar to delete something it wasn't supposed to be deleting. Perhaps the bookmarks were causing a cursor position issue?

    Sorry for the many updates I've added to this thread, but I couldn't let it go even though it is 2am my time!

    The paragraph borders and center justify that append fine on the AsANSIString but not on an AsString is when the last paragraph in the source is the paragraph with those attributes. If I add a another paragraph at the end, AsString works and I get the paragraph border and the center justification. So I guess that's a bug?

    There are other issues with formatting on the last paragraph, like tabstops, etc that are not handled when using AsString to append. So if I use AsANSIString('WPTOOLS'), I lose characters when using bookmarks but I get correct formatting on ending paragraphs. But I don't lose chars when using AsString, but I lose last paragraph formatting.

    What to do???

    Another clue for you all:

    When I go to append the mailmerged template to the report, I use:

    Code
    dest.SelectionAsString := src.AsANSIString('WPTOOLS');

    However, if I change it to:

    Code
    dest.SelectionAsString := src.AsString;


    The problem goes away, but the downside is that some other attributes get lost, like paragraph borders.

    Can't win!