Undo Redo problem

  • Hi Julian.

    I'm using Devcomponents DotNetBar for my user interface, and since there's no way I can make the built-in TextDynamic toolbar emulate the look-and-feel of DNB, a customised toolbar is my only option.

    Mostly, it's a doddle to implement, thanks to the really neat procedures outlined in your manual.

    However, I have run up against one little problem that has defeated all my efforts to solve.

    If I use a drop-down combo box to assign styles (e.g. to paragraphs), everything works fine, with the significant exception that the style change does not register on the undo/redo stacks. Other custom combo-box ops (font-size, font face) do, so the problem looks somewhat specific to this area.

    If on the other hand, I use the built-in combo box to assign the same styles, the style changes do register on the undo/redo stacks, which leaves me wondering what I need to do to achieve the same result.

    Here is the code for my custom combo box:

    Ok, it looks like it should work, but it doesn't, and for the life of me, I can't figure out why. I've tried numerous variations on the above, to no effect.

    I should also mention that it makes no difference whether or not I assign the value "ParStyleSelection" to the Text property of the custom combo, for initialising with InitToolbar().

    Is there any way to ensure ops like this get pushed onto the undo stack, or am I (dear heaven!) going to have to write my own undo/redo engine?

    I'm emailing you two sample projects, one with the default styles combo, and one with my custom combo, so you can see the complete code.

    Thanks,

    Brian

    • Offizieller Beitrag

    Hi,

    I assume you use the wpaActions for the toolbar buttons. You can use those for the combos as well.

    There are this wpaActions available for combos:

    FontSelection
    FontSizeSelection
    FontColorSelection
    FontBKColorSelection
    ParColorSelection
    ParStyleSelection

    For all these actions You can use the "Param" in wpaProcess. If you pass the name of the new style it should be selected as it would have done from the internaly toolbar, including undo.

    The interface CurrApr cannot offer undo support. It is very "low level".

    Julian

  • Hi Julian,

    Thanks for the reply. Yes, I have used wpaActions for both the toolbar buttons and combo boxes, as per your manual. You can check this out in the test code I emailed you on 5th October (Subject: "Undo-Redo Problem Sample Code"). It works correctly for buttons, but not for the combo boxes. The problem seems to be specifically related to paragraph-level operations, i.e. if I select text and execute an action on that (such as fontface change), undo is possible, but if for example I apply a paragraph style (as per the above code example), the style is applied correctly, but Undo is not possible.

    I have spent a lot of time experimenting with many variations, including wpaProcess, wpaExec, CurrPar, CurrParAttr, etc., and nothing makes any difference. I've concluded that I must be missing something, but I've decided to cut my losses in this respect and write my own Undo/Redo engine, which is a better solution anyway for my requirements as it gives me more control over implementation. I was hoping to avoid that, but since it's not working out, I'll just get on with what I should have done to begin with :)

    Regards,

    Brian