Beiträge von skanberg

    Hi!

    I add some custom TWPObjectField to my document and use the OnTextFieldGetText event to put data in the fields.

    Is it possible to save a RTF that does not contain the fields but contains the current data displayed instead?

    I would like to open the file in MS Word which of course don't know what to do with my special fields.

    /Fredrik

    Hi!

    I can't get tabs that I have added to styles to work properly. This can be reproduced in WPMultiDemo.exe (Sample Word Processor):

    Create an new style from the Paragraph Style dialog (Format, Stylesheet) and create some tabs by pressing the Format button, and select Tabstops.

    Close all dialogs and navigate to the end of the editor. Select your new style from the paragraph Styles combo box in the toolbar.

    Now the ruler should show the tabs you have added but it does not. Pressing the tab key just moves the cursor a little bit forward, not to the tab position I have added in my style.

    What's wrong?

    /Fredrik

    Zitat von wpsupport

    This is how it should be done:

    Code
    CurrentParagraph.ASet(WPAT_Alignment, Integer(paralCenter));


    Usually you do this somehwre in the Parse() function of your custom reader.

    I do this in the Parse() function. But I found out that when I set WithClear to true it works (in the LoadFromStream function). If WithClear is set to false it does not work.

    The problem now is that when WithClear is true all my styles gets deleted.

    I saw that the TWPCustomRtfEdit.LoadFromStream calls TWPCustomRtfEdit.Clear which calls TWPRTFDataCollection.Clear with no parameters which means delete all styles.

    To delete the RTFProps.Locked must be false. Is that something I can use to avoid all my styles getting deleted? Or do you have any other ideas?

    This seems to have changed a lot since version 4.

    /Fredrik

    Hi!

    I'm porting my custom text reader from WPTools4 to WPTools5 and can't understand how it's suppose to work.

    In WPTools4 I used to do for example:

    Code
    TextReader.load_par.align := paralCenter;

    In WPTools5 I tried both:

    Code
    TextReader.CurrentParagraph.align := paralCenter;

    and:

    Code
    TextReader.CurrentParagraph.ASet(WPAT_Alignment, Integer(paralCenter));

    But none of this works. What am I doing wrong?

    /Fredrik

    Zitat von wpsupport


    I could add an event which lets you do this, sonmething like BeforeLoadWithReader

    A BeforeSaveWithReader event would also be helpful since I have the same problem. I need to set some properties to my custom reader and writer.

    Will this change be included in the upcoming release 10?

    /Fredrik

    Zitat von wpsupport

    I added a prop for this, thanks for the suggestion

    Thanks, that would be great.

    We also use the TBX toolbar in another project and here the special items also are added. I have found this in WPAction.pas on line 541:

    Code
    FControl.Memo.RTFData.RTFProps.ParStyles.GetStringList(TTBXComboBoxItem(FAttachedControl).Strings, true);

    Is it possible to put a property here also?

    /Fredrik

    It looks like it's impossible to remove these special items:

    In file WPPanel.pas on line 821-822:

    Code
    ItemIndex := FRtfEdit.Memo.RTFData.RTFProps.ParStyles.GetStringList(
        Items, true, FRTFEdit.ActiveStyleName);

    The second parameter indicates that <New Style> should be added to the combobox. This parameter is hardcoded to true. How about a property in TWPComboBox to turn off this feature?

    /Fredrik

    Hi!

    When I create a new document in TWPRichText (or the default document when TWPRichText i created) the paragraph seems to be completly uninitialized.

    For example, I create a new document and then shows the TWPParagraphPropDlg dialog and all values are empty in this dialog. It's the same for character properties like font name.

    The buttons on the ruler are disabled until I move them (or change values in the paragraph properties dialog).

    Is there some way to fill a newly created document with default values?

    This is easy to reproduce, just launch the WPT5TBXDemo, click somewhere in the "WPTools Version 5" text and choose Format, Paragraph. All values except indentation left and right are empty. This is not nice.

    /Fredrik

    Hi!

    I have problems with the left, right, center and justified tool buttons. I use TBX and WPTools actions like WPALeft1.

    The problem can be reproduced in the WPT5TBXDemo project.

    1. Launch WPT5TBXDemo.
    2. Click somewhere in the "WPTools Version 5" text (with orange background).
    3. Click on the center tool button (this works).
    4. Click on the right tool button (this also works).
    5. Now click on the center tool button. This does not work.
    6. Click on the center tool button again. Now it works.
    7. Click on the left tool button. This does not work.
    8. Clicking it again does work.

    Something seems to be wrong here. I can't get it to work in my own project either.

    /Fredrik

    I found some methods in TWPUndoStack that maybe is what I'm looking for, but I can't find any documentation about this class.

    If I do this it seems to be working the way I want it to work:

    Code
    WPRichText.Memo.UndoStack.StartUndoLevel;
    WPRichText.DeleteMarkedCharInAllPar();
    WPRichText.Memo.UndoStack.EndUndoLevel;

    Is this the right way to do it?

    Hi!

    I have som special text objects that can only be deleted in pairs so if a user presses delete before an object I have to look for the other object. When I find them I mark them with the afsDelete flag and then executes the DeleteMarkedCharInAllPar method and my two objects disappears.

    But if the user wants to undo this action and presses Ctrl+Z I get some problem. If the objects are located in the same paragraph they both appear at the same time (one Ctrl+Z), this is good. If the objects are located in different paragraphs, only one object appears at the first undo action. The user has to press Ctrl+Z one more time to restore the second object, this is not good.

    How can I get both my objects to be restored with one undo action regardless if they are located in one or two paragraphs?

    I have some custom text objects that can be inserted in my word processor. The objects are derived from TWPObjectField.

    But when I try to copy this objects to the clipboard and then pastes them with Ctrl+V nothing happens. There are some methods in TWPObjects that are named CopyToClipboard and CopyDataToClipboard but they have zero documentention so I don't know if I could use them.

    How can I make my objects understand copy/paste?

    /Fredrik

    Hi!

    I have a TWPStyleCollection which I load some styles to and I have a TWPToolBar component. In my TWPRichText I have connected the toolbar and the style collection using the WPStyleCollection and the WPToolBar properties.

    My problem is that the paragraph style combobox is empty. I know I have some styles in the style collection because I can see them in my TWPStyleDlg.

    What else do I need to do to show my styles in toolbar?

    /Fredrik

    Hi!

    I would like to get all tabs that are added thru the ruler to round off to decent values, like every quarter of a centimeter, like 0.25, 0.50, 0,75, 1.00, 1.25, 1.50, 1.75, 2.00 and so on.

    But I can't get this and I have tried many different values in Header.RoundTabsDivForCm with no luck.

    And, of course, the properties Header.RoundTabs is true and Header.UsedUnit is UnitCm.

    /Fredrik