Beiträge von michelw

    The following RTF document that was saved in WPTools 2.35 does not display properly in WPTools5.

    Some of the table cells are not displayed properly when using the WordPad5 demo of WPTools5. If I open this RTF document using the WordPad demo of version 2.35 everything is displayed properly.

    Can you please tell me if there is a workaround to fix this.

    Here is the RTF document:


    [/code]


    Thanks,


    Michel

    I am using WPTools version 5.23.3.

    I have an application that positions to cursor at a specific position and then calls BookmarkInput.

    The problem is that the bookmark does not get created at the proper position.

    I have traced to problem to the InputCode method in WPCTRMemo.pas.

    In the InputCode method, there is a call made to the Cursor.ClearSelection(true, true, true) method.

    The last parameter of ClearSelection is a boolean to update the CPPosition (UpdateCPPosition: Boolean).

    I think that parameter should always be false, so that we don't update the cursor position: Cursor.ClearSelection(true, true, false)

    Can you please confirm me if this is a bug.


    Thanks,


    Michel W.

    I have WPTools 5.23.3.

    When setting TWPRichText.ProtectedProp := [ppAllExceptForEditFields], the paste (CTRL-V) is ignored when pasting at the end of an input edit field.

    Here is how to reproduce the problem:

    1- Set the TWPRichText.ClipboardOptions [wpcoDontAutoAppendSpace]

    2- Create an InputEditField with some text between the markers.

    3- Copy some characters to the clipboard and try pasting it between the markers at any position (including at the end). You will see that this works properly.

    4- Now set TWPRichText.ProtectedProp := [ppAllExceptForEditFields] (in my test application I used a TButton.OnClick event to set that value). If you now try pasting the same text at the end (just before the end marker) you will see that the paste does not get executed.


    Can you please validate this and tell me if this is a bug and how to make it work properly.

    Thanks,


    Michel W.

    How can enable/disable the state of a TWPToolButton depending on the Enabled state of another WPTools TWPToolButton.

    For example, I have created a 'Combine Cells Vertically' TWPToolButton and I what to enable/disable it depending on the Enabled property of the default combine cell button since that button already enable/disable itself properly.

    I have tried playing the the different StyleGroup and StyleNumber properties but with no success.

    Currently, my only option is to always leave my TWPToolButton enable. But I want to make it behave exactly like the combine cell button (StyleGroup = 2048, StyleName = WPI_COMBINECELL, StyleNumber = 14).


    Michel W.

    Tabstops not getting alligned on 2nd paragraph until you press <ENTER>.


    Here is how to reproduce the problem with the WordPad5 demo application.

    1- Execute the WordPad5 demo application and don't set any default tabstop in the top ruler.

    2- On the first line, type the numbers 1 to 6 with a <TAB> in between each numbers. After typing the last number (6) press <ENTER>.

    3- On the second line, type the letters a to e with a <TAB> in between each letters.

    You will see that the letters on the 2nd line are not alligned with the first line until we press <ENTER> at the end of the 2nd line.


    Here is what is display on the 1st line and 2nd line:

    Code
    1      2      3      4      5      6
    a b     c            d                       e


    Why is it that the tab stops don't get alligned properly as I type my text. To make it alligned properly, I have to press <ENTER>.

    I want to be able to see the proper allignment as I type.


    Thanks,


    Michel W.

    I have version 5.23.3 of WPTools.

    Graphic popup menu not working properly after setting 'under text'.

    Here is now to reproduce the problem:

    1- In the WordPad5 demo. application, insert a graphic (Insert | Graphic)

    2- Right-click on the graphic and select 'rel. to page - no wrapping'

    3- Right-click on the graphic again and select 'under text'

    You can now type text that will appear on top of the graphic (which is correct), but you cannot right-click on the graphic anymore and remove 'under text'.

    After debugging this, I found the problem in the DoContextPopup method of WPCTRMemo.pas


    This error exists because when calling the Popup method, the SelectedObject is nil.


    Can you please confirm me if this is a real bug and if so, can you please fix this in your next version.


    Thanks,


    Michel W.

    As for a new feature, how about being able to set the visual width for input fields.

    For example to create an input field that doesn't contain text between it's starting and ending markers but would have a default width, just like when you fill-out a paper document.

    For example:


    Code
    +------------+               +------------+
    What is your first name  |            | and last name |            |
                             +------------+               +------------+


    It would also be great if you could specify the maximum text length that the user can enter.

    See this post for more information: http://wpcubed.com/forum/viewtopic.php?t=2821&amp;highlight=

    Thanks you, this now works.

    Just a note: If you want to add multiple checkboxes or buttons in a table cell use the AppendNewPar() method for the 2nd radio button. Here is an example:

    How do you set the BoxWidth of the parent table ?

    Here is what I tried, but it does not work:

    Can you please tell me how to set the BoxWidth of the parent table and also if I need to set WordWrap to false to make this work.

    Thanks,

    Michel

    Of course radio buttons and checkboxes are supported, it is used in your EditFields demo. Here is an example:

    Code
    var
      _radioButton: TWPTextObj; 
    
    
      _radioButton := WPRichText1.InputTextFieldName('FORMCHECKBOX');
      _radioButton.Source := 'RADIO_BUTTON_NAME';
      _radioButton.Params := 'on';


    How can I put a radio buttons inside a table cell ?


    Michel

    How can I create radio buttons inside a table cell ?

    Here is the code that I tried, but it doesn't work:


    Can you please tell me what I am doing wrong ?


    Michel

    The right-most table cell always stretches to the far right even if WordWrap is set to false.

    For example, with the following code:

    Code
    _par := WPRichText1.TableAdd(2,1, [wpTblActivateBorders], nil, nil);
    
    
      _par.Rows[0].Cols[0].ASet(WPAT_COLWIDTH, 1000);
      _par.Rows[0].Cols[1].ASet(WPAT_COLWIDTH, 1000);
    
    
      _par.Rows[0].Cols[0].SetText('CELL1 CELL1 CELL1 CELL1 CELL1 CELL1');
      _par.Rows[0].Cols[1].SetText('CELL2 CELL2 CELL2 CELL2 CELL2 CELL2');

    even if the second cell is set to 1000, it stretches all the way to the right, but the content of that cell gets wrapped properly.

    Can you please tell me if this is a bug or how to get this working properly.

    Essentially, I want to create a single cell table that doesn't stretch all the way to the right side.

    Thanks


    Michel

    After changing the .Name property of a TWPTextObj object, the TXTObject property of the OnTextObjGetTextEx event sees the old .Name property for the closing marker.

    Steps to reproduce:

    1- Create a TWPTextObj object and sets is .Name property to 'BUG' for example.

    Code
    f_obj := WPRichText1.InputEditField('BUG', 'BUG_FIELD');

    2- Create an event for OnTextObjGetTextEx and put the following code:

    Code
    if (wpobjIsOpening in TXTObject.Mode) then  begin    if TXTObject.Name = 'BUG' then      PrintString := '[OBJECT_NAME_IS_BUG'    else    if TXTObject.Name = 'BUG_MODIFIED' then      PrintString := '[OBJECT_NAME_IS_BUG_MODIFIED';  end  else  begin    if TXTObject.Name = 'BUG' then      PrintString := 'OBJECT_NAME_IS_BUG]'    else    if TXTObject.Name = 'BUG_MODIFIED' then      PrintString := 'OBJECT_NAME_IS_BUG_MODIFIED]';  end;

    3- Put some code in button click to modify the .Name property of the object create in step 1. For example:

    Code
    f_obj.Name := 'BUG_MODIFIED';

    4- On screen you will see that the opening marker displays '[OBJECT_NAME_IS_BUG_MODIFIED' which is correct but the closing marker displays 'OBJECT_NAME_IS_BUG]' which is WRONG.


    Can you please confirm if this is a bug and how to fix this. Essentially I want to be able to modify the .Name property of a TWPTextObj object and I want to use that .Name property to add some logic in a OnTextObjGetTextEx event so that I can display custom opening and closing markers.


    Michel

    TWPRichText.Memo.Selected not working properly in BeforePasteText event.

    In my BeforePasteText event I have the following code:

    Code
    if WPRichText1.Memo.Selected then
      begin
        ShowMessage('Text is selected. Prevent paste.');
        par.ClearText;
      end
      else
      begin
        ShowMessage('Text is not selected. Proceed with the normal paste.');
      end;

    Now in my TWPRichText editor, even if I have text that is selected, the TWPRichText.Memo.Selected method always returns False in the BeforePasteText event.

    Note that if I call the TWPRichText.Memo.Selected method from a button OnClick event for example, it returns the correct result.

    Can you please verify if this is a bug or not.

    Essentially I want to prevent the user from pasting text if there is a selection in the TWPRichText.


    Thanks,


    Michel

    As confirmed by Julian, this is a bug that will be fixed in version 5.25.1

    This bug only happens with WriteObjetMode = RTF.


    You can fix this in WPIOReadRTF by commenting two lines:


    Thanks Julian for this fix.


    Michel

    If I trace my application here is what I get (WPIOReadRTF.pas):

    In the TWPRTFReader.CloseDestination method FPictureName is assigned properly:

    Code
    FPictureName := FCurrentExString.GetString;

    But then the TWPRTFReader.ChangeDestination (called from TWPRTFReader.Parse) method gets called which erases the FPictureName (I don't know why your are doing this):

    Code
    FPictureName := '';

    Then the TWPRTFReader.CloseDestination method gets called again with the following code:

    Code
    txtobj := PrintTextObj(wpobjImage, FPictureName, '', false, false, false);

    But FPictureName was erased just before in the TWPRTFReader.ChangeDestination method.


    Here are the exact steps to reproduce this problem:

    1- Create an image with WPRichText1.TextObjects.Insert(_img, _320, 200, 'BUG_IMAGE');

    2- Save your RTF document. (Note that in my application I use another extension than RTF. I also tried this with the RTF file extension and I still have the problem)

    3- Clear your RTF document.

    4- Load your saved RTF document. TWPRTFReader.ChangeDestination method gets called and erases FPictureName (this is the actual bug I think).

    5- Create an OnTextObjectDblClick event with some code and put a break point.

    6- Double-click on your image and you should be in your breakpoint in the OnTextObjectDblClick event.

    7- Inspect the parameter pobj.Name (TWPTextObj). You will see that it is empty.


    Please try to duplicate this bug and then tell me how I can make this work.

    Thanks


    Michel

    In the CloseDestination method of unit WPIOReadRTF.pas I found the code that you are talking about

    Code
    txtobj := PrintTextObj(wpobjImage, FPictureName, '', false, false, false);
            txtobj.Source := FPictureSource;


    But if I put a breakpoint, I see that both FPictureName and FPictureSource are empty.

    Is this a bug ? I have version 5.23.3. Maybe this has been fixed in the latest 5.25 version ?

    Thanks


    Michel