Undo method fails

S

Sergey Zamansky

Hi,
I use Visio 2003 ActiveX drawing control in C++ host application. There is a
scenario when 'Undo' method does not work properly or throws exception.
Using the Visio API I create models: I put several shapes on drawing page
and connect them with dynamic connectors. When the model creation process is
initiated without Visio API I can move any shape in the drawing surface with
the mouse and after that use 'Undo' method with no problem. The second way
to create model is to use modified Visio popup menu
(visUIObjSetCntx_DrawObjSel) in the first model. In other words I create a
second model (another instance of the drawing control) INTO the MarkerEvent
handler code because the Marker event is fired when I click an item in the
popup menu. In such case when I move any shape in the drawing surface with
the mouse and call 'Undo' method it does not work properly or thows
exception. Does it mean that a new instance of the drawing control may not
be created correctly from the MarkerEvent handler code? I need to create
second model from the popup menu 'visUIObjSetCntx_DrawObjSel'.

Thank you in advance,
Sergey.
 
N

niranjan

Sergey,

I encounterd a similar problem, and here is the solution i found.
I figured out that the undo method fails from the marker event i
because, Visio is not finished processing the event stack. As suc
Visio can not carry out undo.

To overcome this, I subscribed to "VisioIsIdle" event of Visi
Application object, which is fired once Visio is done with th
processing of its event stack. And then called the Application und
method inside this event. And it works smoothly.

Hope this helps.

Regards,

Niranja


-
niranja
 

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