Cut does not work properly when ppInsertpointKeepStructure

  • Cut (CTRL-X) does not work properly with InputEditField when ppInsertpointKeepStructure is set in the ProtectedProp property.

    I have a TWPRichText with the property ProtectedProp = [ppInsertpointKeepStructure]

    If I type some text and I create an InputEditField (WPRichText1.InputEditField('TEST')), and then highlight the text including the InputEditField , if I cut the text with (CTRL-X), the whole text, including the InputEditField, gets copied into to clipboard buffer, but on screen, the InputEditField does NOT get deleted. It is still displayed.

    Is this normal ?

    I think that the InputEditField should get deleted when you highlight it and press CTRL-X.


    Thanks,

    Michel W.

  • If on the BeforeCutText event I remove ppInsertpointKeepStructure from the ProtectedProp it work properly, but now I have another problem.

    How to I set back the ProtectedProp property to include ppInsertpointKeepStructure after doing a cut to clipboard. There is no AfterCutText event and using the AfterCopyToClipboard event also does not work since that event is called too soon.

    The only way I can find to do this is to use a timer that will get triggered let say 1 second after the BeforeCutText event. This is not really clean code.

    Having an AfterCutText event will make it possible to fix my problem. Also, it will make sense to have After... events for each Before... events so that we can execute our own code.

    Thanks,


    Michel W.

    • Offizieller Beitrag

    Hi,

    the direct way would be to capture the Ctrl-X control character in OnKeyPress and call CutToClipboard yourself. Before and after that call make any desired change.

    For the toolbar use own code instead of the standard action class.

    Alternativey you can create a class which inhereits from TWPRichText. The method CutToClipboard is virtual and can be overridden.

    Julian