Beiträge von aolson

    Zitat von matthew

    I understand your situation is different, but I'm just pointing out how word processors work. Maybe WPTools does have a solution, but as a general principle you are swimming against the tide in this requirement, and working out how to hyphenate automatically would solve your situation.

    There are reasons for doing what i'm doing, and you and I don't need to get into that here. I understand your point...its just that I need to do what i'm doing, and the only part of WPTools that this breaks is full justification.

    alan

    Zitat von matthew

    I can't say why WPTools doesn't (I am nothing but a user) but this is the same as any word-processor. Try it in Word.

    Code
    The problem is that it would look quite horrible if you had the last line all 
    justified                          across                        the              page.

    That didn't work so well, but it shows the idea.

    I understand what it may look like. The difference is i'm using a very narrow column width so it would never be as exaggerated as you point out.

    Zitat von matthew

    I'll just chip in here, having worked on a word-processor before (just a user of WPTools though). The key here is that full justification is only ever done on the body of a paragraph, and not on the last line of a paragraph. The problem is that the last line will usually be very short compared to the rest of the lines, so it would look quite odd.

    In your situation, you are breaking the paragraph up into lots of little paragraphs, and that is why it is doing what you are seeing. I doubt it would work how you want ever, to be honest. The way forward is to get the hyphenation or other requirement into the WPTools way of working (I don't know if it has a hypenation facility) or to use special break characters that will allow it to work as it currently does. Perhaps using an alternative space character or something (hmm, that might not work either). Anyway, I think an alternative is needed.

    Another question -

    is there any way in WPTools to take a line of text and say "equally space the words in this line so it fills the whole page"? Or is that basically what it does with a paragraph?

    If it does it with a paragraph, why can't it do it with a single line of text?

    I honestly haven't tried ti with a 'regular' page width, but why would it work any differently? I don't thikn this is dependent on the width of the page - I believe its dependent on if there is an explicit CRLF at the end of the line of text.

    as i said previously, after processing my text, EACH line has a hard line break at the end. After processing, there is NO word wrapping. I still need the full justification to work even if there is a hard carriage return at the end of each line of text.

    This is the issue, i believe. Full justification doesn't appear to work on a line when it has a hard carriage return at the end.

    First, I should note that in my application, the page width is less than two inches. Not a "standard' sized document.

    Anyway, if they are typing along and letting WPTools automatically break the lines for them, the text will properly block/full justify. But, another aspect of this application is that prior to the text being stored in a database, some automatic formating/hyphenation code is run on it and this breaks up the lines with hard carriage returns. When this happens...the block/full justification no longer is there in the WPTools editor, and all text is left justified instead. Here are some before/after screen captures:

    Before the text processing, just using auto-wordwrap:


    After the text processing:


    it appears that a single line of text with a hard carriage return at the end cannot be full/block justified so that it fills in the entire page width.

    Any help with this would be greatly appreciated.

    alan

    this is becoming more of an issue now. Users are noticing that the full justify isn't working as expected, that the WYSIWYG display really isn't true WYSIWYG with respect to full justify.

    Is there any solution for this issue??

    Alan

    I'm using WPTools in a Delphi 2007 application where users enter text in a very small column width editor. The component works very well in this situation, but there is one feature that doesn't seem to be working as desired.

    Full justification. Left/center/right justification works as expected, but when i set a block of text to be fully justified, this only works when the text wraps and there are no hard line enders (carriage returns). If carriage returns are usee, the line(s) end up justifying to the left.

    I can't get by the carriage returns. Is there any way to force a single line to justify fully in the editor?

    Thanks,

    Alan

    I've inherited a project that uses WPTools 5.0 extensively.

    The project in many ways is simple, but there is a new feature request that I think should be simple, but for the life of me I can't figure out.

    The project uses one WPRichText control to enter a small amount of text. The user is restricted to the use of a single font. Initially this was hardcoded, but the request is to give a menu of available fonts to the user, and if a font is selected, that font is applied to all text currently in the editor. All font sizes should be retained, as well as all justification, bolding, etc.

    For some reason, I cant get this to work. I figured maybe I could jsut reset teh default font name, but this of course didn't work. Do i need to go character by character, or could I go paragraph by paragraph? And what attribute should I set?

    Thanks much

    I have existing code which works as I want it. I'm having a user build a document, then i'm saving the document in a totally custom format for reasons we do not need to get into at this point. Suffice it to say - it would be easier to save as RTF but that's not possible.

    Anyway, now i'm working on the code which loads these documetns and then rebuilds the document in the WPTools editor. I have pretty much everythign working perfectly except for TWPTextObjs.

    I think the problem i'm running into is due to where the cursor moves to as I'm building the document. Quick question - how do I ensure that after I append a paragraph and set the text, that the cursort/insertion point is always at teh end of the document?

    Thanks,

    Alan

    In my application, almost all actions - point size, styles, etc - are performaned on complete paragraphs, not so much on individual words, etc.

    Is there anyway where i can control WPTools so that instead of the built in selection methods, complete paragraphs are selected instead?

    For example, after the user makes a selection, can i alter the selection so that it begins and ends with a complete paragraph being selected?

    thanks!

    Alan

    I"m making progress, but just ran into one problem.

    I have the code working to partially bold a line via te TParagraph methods. Thanks.

    I also have the code working to set the font size for a TParagraph.

    But, if I change the font size for a paragraph AFTER partially bolding a line, the bolding attribute is gone after the point size change. This is obviously not how i want this to work.

    do i have to go thorugh by character and do something similar to the bolding code to retain this when the point size is changed for a paragraph? Remember, i'm not doing any selection. Each paragraph has to have the same point size throughout it.

    alan

    Thanks again Julian,

    And I have another question...

    Again, on the TParagraph API.

    Lets say i have a paragraph with one sentance, and 6 words. Is it possible, via only TParagraph methods, to bold the first 3 words? OR would this require using character methods?

    Currently I'm accomplishing this via the TextCursor.SetSelPosLen() call and teh TextCursor.SelectedTextAttr.SetFontStyle call.

    Thanks,

    alan

    Hi Julian -

    Thanks for the suggestions. One followup question:

    If i want to set the font size for a TParagraph, is this code correct?

    WPRichText1.ActiveParagraph.ASet(WPAT_CharFontSize,fs);

    If i do this, the attribute is set, but the font size is NOT changed in the editor. Is there a better way to do it to set the font size for an entire paragraph?

    Also, by using the TParagraph API, is it just as easy, or easier, to do full or partial bolding of a paragraph? Or would i have to revert to the character-based attribute approach for that?

    Thanks,

    Alan

    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

    A user found the following bug in a system i wrote. This is written in Delphi 2007 using v5.40 of WPTools.

    In a nutshell, the editor is very simplified. A single line of text can only be one font size, etc, so the commands in general apply to the "current line".

    I sent the font size for a line with the following code:

    WPRichText1.TextCursor.SelectLine;
    WPRichText1.TextCursor.SelectedTextAttr.SetFontSize(fs);
    WPRichText1.HideSelection;

    I then set the justification like this:

    case _Tag of
    0:
    WPRichTExt1.CurrAttr.Alignment := paralLeft;
    1:
    WPRichTExt1.CurrAttr.Alignment := paralCenter;
    2:
    WPRichTExt1.CurrAttr.Alignment := paralRight;
    end;

    The issue that came up seems to arise ONLY when working with the last line in the editor.

    For example, they set a font size for the last line, then center-justify that line. What happens is it is center justified, but the font size reverts to the previous size.

    Why would this happen? Something to do with line enders?

    Thanks,

    alan