Beiträge von Steven

    Sorry, I forgot the background information:
    We want to implement a text comparing tool using "TWPRichText". I implemented a frame with two "TWPRichText" next to each other (let's call them "Text_A" and "Text_B").
    The compare lib compares the paragraphs of "Text_A" with "Text_B".
    When the compare lib finds an added paragraph in "Text_B" an empty paragraph has to be added to "Text_A". The new paragraph needs to have the same height as "Text_B" but without text in it. This is necessary to make sure that the following paragraphs are at the same height.

    My idea is to:
    - create an empty paragraph in "Text_A"
    - calculate the total height of the paragraph added in "Text_B"
    - add an empty line (or maybe a ' ' if an empty line is not possible) to the new paragraph
    - set the font size of the added line to the calculated total height

    I tried:
    "MulDiv(par_original.LineHeight(i), 72, Memo.CurrentYPixelsPerInch)"
    but it returns 18 if the font size is 16 and 13 if the font size is 11.

    Zitat von wpsupport

    LineHeight depends on the Resolution which is Memo.CurrentYPixelsPerInch - usually that is 600. It does not depend on zoom.

    You can convert that in pt, using MulDiv( val, 72, Memo.CurrentYPixelsPerInch)

    If you need Pixels, use ScreenResolution - see FormatOptions. ("Height in Pixels" always depends on Resolution)

    Hi again,

    Thank you for the answer. However, I am at a loss how to do it.
    Why do you multiply by 72? What is 72? Is it "Screen.PixelsPerInch" (should be 96)?

    I need the pixels. Could you please tell me how to get it?
    I just found "wpfAlwaysFormatWithScreenRes" in "FormatOptions" but the result is always the same if I set it to true.

    Thanks in advance :)
    /Steven

    Hi again,

    It's working now. I just forgot to call "ReformatAll" after one style change.

    There remains a further question: How to get the FontSize of the highest character in a line? If this would be an expensivie operation, how to get the height of the whole paragraph in pixel (independently of the resolution, zoom)?

    I tried "paragraph.LineHeight(line)" but the result seems to be related to the resolution, zoom or something else.

    Basically, I would like to create an empty paragraph (in another "TWPRichText") which has the same height like the first one.

    My idea:

    Code
    par_copy := (par_original.CreateCopyList(False, par_original));
    par_copy.Clear;
    
    
    RichText1.AttrHelper.Clear;
    RichText1.AttrHelper.SetFontSize(HEIGHT_OF_par_original);
    
    
    par_copy.SetText(' ', RichText1.AttrHelper.CharAttr);
    // add par_copy
    Zitat von wpsupport

    Hi,

    the TWPPreview should do this, if in "thumbnail mode".

    In ViewOptions the "wpAutoThumbNailMode" flag must be active, as in the "mini Editor" demo.

    It's not working.
    I tried the demos "A)_Mini_Delphi5_Editor" and "F) Mini Editor". There is no preview in "F) Mini Editor".
    On the other hand, "wpAutoThumbNailMode" is switched off in "A)_Mini_Delphi5_Editor".
    However, it's even not working if I switch it on. The preview is not moving to the current page when I move the cursor to another page in the TWPRichText.

    Zitat von wpsupport

    1+2)

    Disabling the toolbar is not recomended. But the next build will disable the state of many buttons if the Editor is readonly.

    3) will be updated.

    1+2) What would be the recomended way to disable the tool bar/editor in "view mode"?
    3) Thanks a lot.

    Hi,

    "line" migh be wrong word for the "thing" that I am searching for, but I don't know the exactly term. So don't hesitate to correct the title.

    Imaging the following paragraph:

    This is a very long
    sentence that is auto
    wrapped for because
    of its length.

    The paragraph has only one sentence which is auto wrapped because of it's length. There is no line break within the sentence.

    I would like to get the "line count" (4 in this example) and the text of every line.
    In addition, I would like to know the height of each line (height of the largest character).

    I just tried
    - par.LineCount -> returns 0
    - par. LineAllCount -> returns 0
    - par.Lines -> is empty
    - par.LineHeight

    It looks like that "line" is a sub sequence which ends with a "soft line break" (like "\line" in RTF).

    BTW: Is there a const for a "soft line break"? If not, how to add a "soft line break" to a paragraph?

    Thanks in advance :)
    /Steven

    Hi,

    I have two issues with the TWPPreview:

    1.)
    Is it possible to visualize the current page in preview (maybe with a selection border around the page)?

    2.)
    It would be very nice if the preview moves to the current page if it changes in the related TWPRichText (inclusive scrolling). Is this feasible?

    Thanks in advance :)
    /Steven

    Hi,

    I found a refresh issue in some of the WPTools controls.
    affected: "TWPRichText" and "TWPPreview" (maybe also other controls)

    Steps to reproduce:
    1. start "WPTools 7 Editor"
    2. click on the "print" button (tool bar) -> the dialog appears
    3. move the dialog over the WPTools controls.
    -> now you can see the issue
    4. close the print dialog
    -> the issue still remains

    You have to click in the affected control or change the size of the affected control in order to get it fixed.

    Thanks in advance :)

    /Steven

    Hi,

    I have some issues with the predefined tool bar.

    Background information:
    My application has several "UI-Modes", however you can group these modes into "view" and "edit". I just set the "Enabled" property of the "TWPToolbar" and "TWPRichText" to False on any "view" mode.
    On the other hand, I set it to True on any "edit" mode.

    1.)
    It's working well for all tool bar buttons excepting "Hyperlink Style" and "Spellcheck". The bound action is enabled even if the related "TWPToolbar" and "TWPRichText" is disabled (Enabled = False). Which means that:
    - "Hyperlink Style": the entered link is going to be added to the current cursor position.
    - "Spellcheck": You can perform the spellcheck even if the "TWPRichText" is disabled (Enabled = False). --> manipulate words.

    It looks like a bug.

    2.)
    Some of the tool bar buttons have the behaviour of toggle buttons if the tool bar is disabled (Enabled = False). That means the button remains to be down/up after a click. Here a list of buttons with this behaviour:
    - Insert Image
    - Insert Symbol
    - Header and Footer
    - Numbers and Ou...
    - Paragraph Properties

    BTW: Is it possible to disable some of the tool bar buttons if the related tool bar is disabled (Enabled = False) by using the predefined tool bar?

    3.)
    "Spell-As-You-Go": The initial state of this toggle button is off even if the related feature is active. So it shows the wrong state and you have to click twice in order to switch the feature off.

    Thanks in advance
    /Steven

    Hi,

    I am using the default TWPToolBar provided by WPTools (with predifined buttons). I would like to use my own icons instead of the default icons for some button.
    I already tried the WPImageList, but without success.

    How to assign my own icons to some buttons?

    Thanks in advance :)
    /Steven