Undo for Moving Object

R

rafi qadri

HI
I am right now working on Viso Activex Control in dot net . I am trying
to implement "Undo for Moving Object" .
I have used the following functions but its unable to Undo the action when
the object is moved . The undo functionality is only working on Adding ,
Deleteing an object but not on Moving object

VisioApp.Undo()
VisioApp.DoCmd(VisUICmds.visCmdEditUndo)
VisioApp.DoCmd(VisUICmds.visCmdEditUndoMultiple)
Regards
 
S

Shahzad Godil

We already have knowledge of BeginUndoScope and we did this for some our
custom action. But this is simple shape object move using mouse drag.
How can we implement this.
 
C

Chris [Visio MVP]

You have to start and end an UndoScope, with your code in-between.

Goto Visio's Developer help and look for "BeginUndoScope". There's a code
example in there.

The general code looks *something* like this:

Application.BeginUndoScope
'do something
'do something
Application.EndUndoScope

You can give the scope a name, that will show up nicely in the undo menu,
like "Undo Rafi's Stuff", and you also get an ID so that you can be sure of
what scope your a looking at.

Again, the help file has the details.
 
C

Chris [Visio MVP]

Then you need to watch a CellChanged event. If you use the AddAdvise method
of watching for events, you can set upa filter to limit the amount of
garbage you have to sift through - ie: give me only a PinX/PinY cell-changed
event.

Or you can call a procedure from the cell's EventXFMod cell. This changes
whenever a cell in the ShapeTransform section is modified (ie, size or
position)

You can use the ShapeSheet function "QUEUEMARKEREVENT" to contact your
add-on code.


--
Hope this helps,

Chris Roth
Visio MVP
 
S

Shahzad Godil

I don't know why it is become too complex. Using Ctrl+Z to undo is working
fine with move and all action. Only thing is that when we are calling
command function to undo from our custom menus.

VisioApp.DoCmd(VisUICmds.visCmdEditUndo)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top