Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
910
RestoreOriginalValue issue in RibbonTool
posted

Hi,

we have the current workprocess:

When the user edits in a ribbon tool (e.g. in a comboeditor) a value, the value should be restored on pressing 'ESC'. Therefore we attached to the 'EditorTool_BeforeToolExitEditMode' event to restore on e.CancelEditMode && !e.ForeceExit (-> e.RestoreOriginalValue = true;)

Unfortunately this restores the value also if the user is in edit mode and clicks on a different ribbon tab.

But we would like prevent the restore in this case.

Any ideas how to achieve this?

Thanks in advance,

Michael

Parents
No Data
Reply
  • 21795
    Verified Answer
    Offline posted

    Hello Michael,

    When you switch the ribbon’s tab this forces the TextBoxTool to exit edit mode, if there is such tool in edit mode. And this sets CancleEditMode property of BeforeExitEditMode event arguments to true. So this is expected behavior.

    What you can do to retain the value of the text box when changing the tabs, but restore the old value when ESC is clicked is this:

    1. Handle AfterToolEnterEditMode event of toolbars manager. If the tool is TextBoxTool save its Text to a local field;
    2. Handle ToolKeyDown event of toolbars manager. If tool is TextBoxTool and ESC key was pressed restore the tool text and force it to exit edit mode.

    Attached is a small sample showing this approach.

    Please let me know if you have any additional questions.

    UltraToolbarsManagerRestoreToolValue.zip
Children
No Data