Skip to main content
Inspiring
March 22, 2011
Answered

How to rollback commands

  • March 22, 2011
  • 1 reply
  • 681 views

Hi All,

I am working  with anchoring an item and creating hyperlink for that item. For this I  am processing kCreateAnchoredObjectCmdBoss,  kNewHyperlinkPgItemSourceCmdBoss, kImportCmdBoss commands using  CmdUtils::ProcessCommand(). After Import I do some resizing with the imported object.

In this process after kImportCmdBoss command is completed, I perform some checks and want to do a rollback of all commands performed till now. i.e. after rollback document state should be what it was before  kCreateAnchoredObjectCmdBoss,  kNewHyperlinkPgItemSourceCmdBoss, kImportCmdBoss processed.

how to do auto rollback or call undo commands ?


In the Programming Guide, I read the whole text under "Undo and Redo Commands". It says all undoable commands manages ICmdHistory. Do I need to implement a custom Interface which inherits from ICmdHistory ?

I have tried using CmdUtils::BeginCommandSequence(), CmdUtils::AbortCommandSequence()and CmdUtils::EndCommandSequence() methods, these didn't work. Can anybody help me?


Thanks,
D
This topic has been closed for replies.
Correct answer divya_jain

Used CmdUtils::BeginAbortableCmdSeq() before kCreateAnchoredObjectCmdBoss command and CmdUtils::AbortCommandSequence(seq) where kImportCmdBoss return.

1 reply

divya_jainAuthorCorrect answer
Inspiring
May 8, 2012

Used CmdUtils::BeginAbortableCmdSeq() before kCreateAnchoredObjectCmdBoss command and CmdUtils::AbortCommandSequence(seq) where kImportCmdBoss return.