Problem with SetTabPos

  • Hello!

    I have a problem with TWPRichText.SetTabPos. If I call SetTabPos from the forms oncreate event the tabs are not set. If I add a button to the form and call SetTabPos on the onclick event the tabs are set correctly.

    How can I set the tabs during form creation? It must be done from code.

    I use WPTools 4.25.

    Regards,
    Erik

  • Hello again,

    just to elaborate on this, the problem appear to be related to the width of the TWPRichText control. If I try to set a tabpos at 15 centimetres and the control is not wide enough to display the 15 centimetre point in the ruler then the tabpos is not applied.

    /Erik

  • Hello again,

    I tried both the OnShow event and overriding TForm.DoShow without luck.

    Some of the tabs are set but the one's that is beyond the forms border (because the form is not maximized at startup) is not.

    The RichText component is located on a frame. Wordwrap is enabled.

    What next?

    Regards,
    Erik

  • Hello again,

    i did some debugging and found the offending code in TWPCustomRtf.Edit.SetTabPos:

    else if (tw > 0) and
    ((not FMemo.UseViewport and
    (tw < MulDiv(FMemo.WidthInScreenPixels, 1440, FMemo.Header.FFontXPixelsPerInch)))
    or ((FMemo.UseViewport and (tw < FMemo.FLogWidth)))) then

    The problem is that tw is greater than
    MulDiv(FMemo.WidthInScreenPixels, 1440, FMemo.Header.FFontXPixelsPerInch)

    What is this check doing?

    Regards,
    Erik