Explanation of my project and recent questions

  • hi All -

    I've recently made several posts here asking somewhat similar questions, and I thought perhaps it would be beneficial to outline this project and explain how i'm trying to use WPTools to achieve what i want. I'm thinking that perhaps i've made a flawed assumption somewhere and there is a simple solution for all the issues i'm seeing.

    I'm writing a simple editor for entering small amounts of text which are advertisements. With this implementation almost all operations on the text are line-based. For example, either an entire line is in bold or not. Same thing with point sizes - the entire line has to be the same size. with this approach, the user doesn't have to make a selection first , he just has to be on that line and select a menu option or button.

    Since everythign is line based, I'm using FastAddText to fill the editor line by line if the text already exists. I'm wondering if this could be the cause of some or all of my problems?

    Problems arise in several areas. First, I can't seem to block justify a line with this approach. I think this has to do with hard vs. soft line breaks when i add each line as a paragraph.

    I am also seeing issues with my last line of text. If the user changes the size of the font on teh last line, then centers it, for example, the font size reverts to the previous size for some unknown reason. Again, is this a line ender issue?

    Also, i'm using WPTools in the wplayExtendedPageGap layout mode. Could this aspect play a role at all?

    Any help with any of this would be appreciated.

    Alan

    • Offizieller Beitrag

    Hi,

    If you work strictly with paragraohs, not with lines, You can use a very powerful API in TParagraph to assign paragraph attributes and character attributes.

    If the text does not use character attributes all attributes from the paragraph are used. This works just like in HTML with
    <p style="...">....</p>

    FastAddText is old fashioned, it would be better to use TParagraph objects and add them in code:

    newpar := WPRichText1.ActiveText.AppendPar(nil, lastpar)

    Kind Regards,
    Julian