Beiträge von bhenke

    Hello,

    we're currently having trouble with some RTF texts containing single chars with a special symbol font. ReformatAll sometimes raises the exception "Internal error in reformat routine. Please save your text!". It's currently unknown why this sometimes happens and sometimes not (for the same text), it may depend on page sizes.

    Commenting out the exception in WPRTEDefs seems to help but we're unsure about the side effects. The condition for the exception is FCanCheckNewPage.

    There are only two lines where FCanCheckNewPage may get set to false:
    The first one is below "if (findmode = wpNoSpaceAtAll) and not FCanCheckNewPage and (w > 1) and (h > 1) then" which wouldn't be entered if FCanCheckNewPage wouldn't already be false (dead code?). The second one is "FCanCheckNewPage := aTextObject = nil;". In our error case, aTextObject is assigned here and points to a wpobjTextObject with the symbol font mentioned above.

    Any idea on how to fix or avoid the problem would be appreciated.

    Thanks

    - Bjoern Henke -

    Hello,

    I have a problem with ParagraphStyles and the DefaultAttr.

    I create two ParapgraphStyles like this:

    Code
    Style:=RichText.ParStyles.AddStyle('MSGTITLE');Style.ASetAddCharStyle(WPSTY_BOLD);Style:=RichText.ParStyles.AddStyle('MSGTEXT');Style.ASetDelCharStyle(WPSTY_BOLD);


    Both should be derived from the DefaultAttr.

    At first this seems to work. I'm using this code to add paragraphs to the rtf control:

    Code
    if RichText.IsEmpty then Par:=RichText.LastPar
    else Par:=RichText.LastPar.AppendNewPar;
    Par.ABaseStyleName:='MSGTITLE';
    Par.SetText('['+Time2Str(TimeGetTime)+'] '+Match+':');
    
    
    Par:=Par.AppendNewPar;
    Par.ABaseStyleName:='MSGTEXT';
    RichText.CPPosition:=MaxInt;
    RichText.SelectionAsString:=Msg;


    The variable Msg can be RTF-Text. If this is the case and the font differs from the DefaultAttr, then the next time I add a new paragraph, the Style MSGTITLE isn't derived from DefaultAttr anymore, but from this new font style.

    So my question is:
    Can I add a new ParagraphStyle as a real copy of the DefaultAttr?
    Or is it possible to set the font back to DefaultAttr after SelectionAsString:=Msg?

    Regards,
    Björn

    Hello,

    I'm successfully drawing the richtext on a canvas by using the PaintRTFPage procedure. Now I'm trying to do the same, just with WordWrap. So I set RichText.WordWrap:=true, but now my procedure doesn't draw anything anymore. The canvas stays empty.

    What do I do wrong?

    This is my procedure (WordWrap is already true):

    Regards,
    Björn

    Hello,

    we're using WPTools with Layout wplayNormal, to let it nearly look like a normal Memo. The user can show and hide a ruler to see tabs and the page width.

    The problem is, when the ruler is invisible, the user doesn't see anymore where the page ends. Is it possible to show a thin line at the right page border?

    I tried to use wpDrawPageMarginLines in ViewOptions, but it seems not to work with Layout wplayNormal.

    Regards,
    Björn

    Hello,

    if I print the rtf text on a bitmap, I can't get it to be really transparent (no white background, just the text and text-background).
    The problem seems to be that everything is drawn in ClearType / Antialiased. Normally you can disabled that by doing something like this to a font:

    Code
    GetObject(Font.Handle, SizeOf(TLogFont), @tagLOGFONT);
    tagLOGFONT.lfQuality := NONANTIALIASED_QUALITY;
    Font.Handle := CreateFontIndirect(tagLOGFONT);


    But this is not working, because I can't change the fonts in WPTools this way.

    Is there any way to have really transparent text drawn on a bitmap without using SystemParametersInfo(SPI_SETFONTSMOOTHING, Cardinal(False), nil, 0) ? I don't want to set it globally.
    Regards,
    Björn

    I installed the current release of WPTools. The problem with the BkColor seems to be better, but in some cases it still looks terrible.
    For example: BkColor is set to some color and the style is italic, then the characters get truncated.
    Also the characters wander again with set BkColor although wpfUseKerning is in FormatOptionsEx2.

    Hello,

    when I set Transparent to true the Scrollbar isn't working anymore. It's not visible and if you click into the area where it's supposed to be, it shortly flickers.

    I tried to not use Transparent and set the color to the same color as the underlying panel. The only property which seemed to fit was ColorDesktop, but it seems to have no change. The background color stays at white. Is there any way to change the overall background color? Layout mode is normal.

    Regards,
    Steffen

    Hello,

    it seems like the format string 'RTF-nopageinfo' is not working as supposed to (according to https://www.wpcubed.com/manuals/formatstrings.htm this should be a valid combination). The page info still gets written to the RTF.

    In TWPRTFWriter.WriteHeader the if-clause 'not (soNoPageFormatInRTF in FStoreOptions)' is always true no matter how the format string looks like. In my opinion the if-clause should be 'not OptNoPageInfo and not (soNoPageFormatInRTF in FStoreOptions)' like in other places in the same unit, shouldn't it? OptNoPageInfo is correctly set by the format string.

    Regards,
    Björn

    Hello,

    which is the easiest way to know if the cursor is in the first or the last line of the whole text? Just somewhere in it.

    Background is, that I want to jump to the next control in the tab order if you press arrow up / down in the first / last line.

    Regards,
    Björn

    Hello,

    I did now set the PageHeight to the maximum and I'm trying to make a extern scollbar based on the PaintTextHeightPage.
    But I can't get it to work. When the actual text height gets bigger, the max value of the scrollbar isn't big enough anymore.
    I tried to convert the values, but this just made it worse.
    Any idea what I do wrong?

    Regards,
    Björn

    Hello,

    is it possible to configure WPTools not to use pages respectively to just have one page which is infinitely long (like a memo)?

    My current approach was to set the PageHeight to MaxInt, but then I have a pretty long scrollbar. The scrollbar should just react on PageTextHeight.

    Any idea would be appreciated.
    Regards,
    Björn

    Hello,

    there is a rendering bug when using a background color of a text.

    This is a correct example without BKColor:
    [Blockierte Grafik: http://img686.imageshack.us/img686/4149/wptoolsfine.jpg]

    This is the same text with a BKColor:
    [Blockierte Grafik: http://img194.imageshack.us/img194/2747/wptoolserror.jpg]

    Some characters are cut off. Seems to always be the last character before a separator (e.g. space or "-"). This needs to be fixed.

    Also: why does some characters always move a little when typing or selecting text? This looks pretty weird.

    Regards,
    Björn

    I figured that it was a problem with the margins and the resolution. The Draw function doesn't draw clipped, only whole lines are drawn and if the rectangle isn't big enough to draw one line it draws nothing and the starty parameter doesn't change.

    Is there a way to let the draw function draw clipped? There is a property Memo._NoClipping, but it doesn't change anything.

    The problem is, that we need to draw the text into a grid control and we have the restriction that we need to draw it in 20 pixel portions. Without clipping this is not directly possible. We would need to draw the text on another canvas and then copy each part to the canvas of the grid.

    To draw the text to another canvas, we would need to have the total height of the complete text, because the canvas needs to have the exact bounds of the text to read it in 20 pixel portions. Is this Memo.PageTextHeightPix? We always have only one page of text.

    This is a pretty complicated matter, but it decides whether we can use WPTools throughout our application.
    Any help would be appreciated,
    Björn

    Hello,

    could you please tell me why this code isn't working?

    Code
    PosY:=0;
    StartY:=0;
    while PosY<Image.ClientRect.Bottom do
    begin
      DrawRect:=Rect(Image.ClientRect.Left,Image.ClientRect.Top+PosY,
                     Image.ClientRect.Right,
                     Image.ClientRect.Top+PosY+80);
      StartY:=RichText.Draw(Image.Canvas,DrawRect,0,StartY);
      Inc(PosY,80);
    end;

    It just draws a white background.
    Regards,
    Björn

    Hello,

    I'm in need to print line after line (not a whole page) on a canvas. Is this possible? The function Draw() seems to be a good starting point, but each line can have a different height, so I don't know how to set the offset.

    Any idea would be appreciated.
    Regards,
    Björn