visio internal error 2123

V

VM

Hi,
I am struck up with the following problem in visio. I am getting the
following error Visio Internal Error #2123 in one scenario. I want some
explanation for the cause and resolution suggested online in the context of
our scenario.

We have an Addon written for Microsoft Visio. We have two kinds of shapes,
switches and diskarrays. Both are grouped visio shapes.
We are handling the undo and redo mechanism according to the Microsoft visio
documentation.

I have dropped three switches which are connected by cables (another kind of
shape).now I select them all together and delete them. Now I do cntrl+z to
retrieve them back. But I what I get is visio error. If I group them all and
repeat the scenario I do not get the error.

The cause of the error as it is mentioned at
http://support.microsoft.com/default.aspx?scid=kb;en-us;294104 is that the
shapes are with in three units of another visio shape. I do not understand
the term unit. I am not able to take the meaning of the term unit to be
distance because of the following case. In the above diagram if i replace any
one of the switch shape by a diskarray shape then I am not getting any error.
Also the context given in the site where the error is supposed to come is
different to the context where the error is coming for me. There some shapes
are drawn and they are deleted using UNDO command (cntrl+z option) whereas I,
here, have drawn the above said combination,
then deleted them normally, then tried to retrieve them by using
cntrl+z.Therefore I do not understand how the resolution suggested “delete
the most recently placed shape instead of using the Undo command†is helpful
to me.â€

Could any one clear me on the cause and resolution of the above error in the
context cited above.
The version of the visio I am using is Visio profesional 2003(11.3216.6360).
 
M

Mark Nelson [MS]

I believe that the knowledge base article specifically applies to Process
Engineering diagrams, so the information may not be applicable to your
situation.

It's not clear from your explanation whether you are programmatically
creating Visio undo units and/or manipulating the Visio diagram in response
to undo or redo. Make sure that your code does not modify the Visio diagram
during undo or redo. You should be checking for this state whenever you
handle an event from Visio.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Hi,
Could you please signify what does the term “units†mean. Does it mean any
thing related to z-order.
We are programmatically creating undo units. I need a clarification here.
Say I have pushed an UNDO unit which encompasses parallel information, an
application object which is our own object. Does Visio also push an undo unit
parallely which encompasses information about the state of Visio application.
I have got some recent observations on the problem. Please see if they can
get you some more idea about the problem.
1) We have different kinds of shapes like switches, cables, fabrics. Now
when a user drops a switch from stencil we programmatically drop a shape
called fabric. Basically all the switches connected by cables is called
fabric. This fabric shape by default design is lock shaped. There fore when a
user selects all the switches and cables by CNTRL+A he can not select this
fabric. Say a user has done CNTRL+A and selects all the switches and cables.
Now he deletes them. We then delete this fabric shape programmatically. Now I
say CNTRL+Z I am getting the problem. So WHAT I HAVE DONE IS I have made the
fabrics explicitly selected by users along with switches and cables and
delete them simultaneously instead of deleting the fabrics separately thru
programme. Then there is no BUG. But unfortunately we can not allow a user to
explicitly select the fabric shape.
2) Another observation: when I am dropping cables I am pusing them using
sendtobackward thrice. The other shapes, after being dropped, I am doing
bringforward thrice. Then no BUG comes. But any slightly different way of
pushing shapes is not working. We could not accept this solution for we do
not understand the reason explicitly.

Any slight help will be greatly appreciated.
 
M

Mark Nelson [MS]

By unit I mean something that implements the IVBUndoUnit interface, which
allows programs to add their own items to Visio's undo queue.

Here is my simplification of the scenario below. When the user drops shapes
on the page, you programmatically drop additional shapes. When the user
deletes shapes from the page, you programmatically delete the shapes you
added. You also want to handle undo properly.

If this is all you are doing, there is no need to create undo units and add
them to Visio. Any change you make to the Visio drawing is automatically
folded into the existing undo unit. When the user drops a shape, Visio
begins an undo scope for that action and then fires events to notify you
about the action. You handle the event and tell Visio to drop another
shape. Because Visio is in the middle of an existing scope, your changes
are recorded in the existing undo unit. Once everyone has been notified of
the events and responded, the undo scope is closed and the undo unit is
placed in the Undo queue. If the user chooses Undo, your changes are
reversed and then the user's changes.

It is important to understand that Visio will fire events in response to
changes you make to the document. If you handle ShapeAdded and
programmatically add another shape, you will get a second ShapeAdded event
that you need to properly ignore. It is also important to understand that
Visio will fire events during Undo and Redo. If the user undo's a shape
add, you will get the BeforeShapeDelete event. You should not make ANY
changes to the Visio document during undo or redo. Visio already knows what
changes to make. The events are fired so that you can update any
information you are managing outside the Visio drawing.

If after reading this, you think your scenario really does require creating
your own undo units, post again with more information about your scenario.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Thanks for your response.
we require creating our own undo units for maintainig our internal
datastructures about the relation between switches and fabrics. for now i
have removed all the undo
code.so for now i am not handling undo code at all.
1)In the viseventaddshape when it is fired for the shape added
programatically i am seeing that i do nothing.
2)In the events fired during undo or redo i am seeing that i do nothing.
Still the problem persists.
Another thing:
as per my second observation given in my previous writing when i push cables
down i am not getting the error.
If i take the reason to be that visio is creating new undo units for those
sendtoback actions and thus accounting for solving the problem coming in undo
units ,then the same should happen when i push cables to front instead of
moving back and the error should not come which is not happening.
 
V

VM

This is some addition to your simplification of scenario below. We ALSO add
shapes programatically during the events like visevtconnect and also delete
some shapes that were dropped earlier in the similiar fashion.The Undo unit
observed in the Edit box just before selecting all the shapes "undo size
object". The undo unit observed in the Edit box just after deleting all the
shapes selected is "undo set formula".
Now we do CNTRL+Z.
 
M

Mark Nelson [MS]

Thanks for the additional information. At this point I don't have any
further suggestions. The most common issue here is that a program tries to
tell Visio to modify the drawing while in an undo scope.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Hi Mark,
I have got rid of the visio error 2123. what i did is that in my code i have
deleted all those additional shapes that were added through code in an event
called BeforeShapeDeleteEvent. That has solved the bug.
I still do not know the basic reason but i understand it as:
whenever visio fires an event it opens an undoscope .
so for beforeshapedelete event all the additional shapes must have been
deleted in a separate scope and all the MAIN shapes in another scope that is
opened before
normal shapedelete event.
Please clarify me if you can understand better.
Thanks a lot for your support. With the basic understanding that u have
given about Undo scope i have fixed lots of bugs that were long term pending

Now can u do me one more favour.
There are two other things i need clarification about
1)Initially after opening BSD,our product an Add-on to Visio,i drop a
shape.then i do undo. i think i will go back to the initial state. now i drop
again the shape,In shape added event i tried to get the containingpage of the
shape like
shape->ContainingPage->Document where shape is the visio shape. but the
containing page value is coming null or undefined.
2)After the step 1 i delete the shape and do cntrl+z then again cntrl+z now
i do cntrl+y , i am getting this error visio internal error 2907 a new one.
please explain me the error message. i tried to search in support.ms.com
but i could not find any related message.

Thanking you once again,
 
M

Mark Nelson [MS]

I am not sure of the specific issue caused by adding shapes in the
BeforeShapeDeleteEvent. I can definitely say that you are not allowed to
delete shapes from within that event. It may follow that you cannot add
shapes from within the event and then Undo, since that is fairly similar to
a delete. Why does Visio prohibit delete from within a delete event? This
relates to the difference between Before and After events in Visio. During
a Before event, Visio is in a transitory state. It is about to perform an
action. Thus changes to the drawing can potentially disrupt the action.
Visio actually fires a BeforeModal event to notify you that it is entering a
transitory state and is not able to respond to most drawing changes. An
AfterModal event signals when Visio is out of this state. When Visio fires
After events, it has already performed the action it is telling you about
and can thus accept further modification to the drawing.

The best practice here is to avoid making changes to the Visio diagram
within event handlers. Create a task queue that tracks the things you need
to do in response to Visio events. When handling a Visio event, put the
appropriate task on the queue instead of directly executing the task. Then
listen for the NoEventsPending event from Visio. This is Visio's all-clear
signal, meaning Visio has finished its notifications about all the current
changes to the drawing. Now process your task queue, executing each task in
turn. At this point you should set a flag letting your event handlers know
that any notifications from Visio are the result of your tasks and not the
end user. It's a little more work to set this system up, but you will find
things go much more smoothly.

There is one additional point to make about Before events. Visio fires
Before events for actions that destroy objects such as BeforeShapeDelete or
BeforePageDelete. If you wait to take an action on such an event later (in
NoEventsPending), the object will no longer exist. Thus make sure you
extract whatever information you need while it is still around and store
that information as part of your queued task. Typically you might have a
unique identifier on the shape that you want to remember.


--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

HI,
I think i have mis lead u in my earlier mail. I have got rid of the Bug 2123
because now i have done deleting/adding additional shapes in before delte
shape. Previously it was all happening in after delete event. but i notice
the practise suggested by you to queue up things and would look to implement
that.
Now i am struck with two other new things which are not relevant to 2123.
1)Initially after opening BSD,our product, an Add-on to Visio,i drop a
shape.then i do undo. i think i will go back to the initial state. now i drop
another shape, In shape added event ,in code, i have tried to get the
containingpage of the shape like shape->ContainingPage->Document where shape
is the visio shape. but the containing page value is coming null or undefined.
Please tell me what could be the possible reason for this to happen.
2)I am getting this error visio internal error 2907 a new
one. please explain me the error message. i tried to search in support.ms.com
but i could not find any related message.
 
M

Mark Nelson [MS]

I am not familiar with this specific problem or the 2907 error number. I
have experienced issues where Visio is confused about which object a
variable currently represents, especially after delete or undo. I'm not
sure from your comments whether you are reusing the same shape variable
after undo. If so, the usual workaround for such a situation is to set your
variable to null or nothing before using it again.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Hi Mark,
This is another question about the order of execution of event handlers and
undo units DO code.
say i have a shape dropped on page. now i do ctrl+z.then DO code gets called
first and then shape deleted event. now i do ctrl+y. DO code gets called
first then shape added event. So i have assumed the DO code of all undounits
gets called first and then the events while we do undo or redo.
But if the shape is complex shape like a collection of different shapes then
this order
becomes un predictable. like i DO cntrl+y some events gets fired first and
the DO is getting called either in between or after all the events got fired

I want to clearly understand the flow of events when we do undo and redo.
Is there any specific article which deals with the same in detail.

Thanks in Advance.
 
M

Mark Nelson [MS]

Are you using the EventMonitor tool that comes with the Visio SDK? It
should clearly show what is happening.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Hi Mark,
I am getting visio internal error 2220. Action 1246: Drop on page.
Scenario is,
I have a huge shape dropped. now i do ctrl+z. That operation takes some
time.Mean while the cursor wil be hung. Now ,when the cursor is still hung,if
i drop any shape from stencil i am getting above error.
This carries on with other operations i try to do while the cursor is hung
but with different action codes. For example i try to move another shape.
viso internal error 2220,Action 1187:Move object.

I agree that we should not do any valid operation while the cursor is
hung,but is there any way we let the operations not be done or atleast let
the visio not throw the error messages.

Thanks in advance,
 
M

Mark Nelson [MS]

Ideally you should never get a Visio internal error, but there are
circumstances where it might happen. If you want to send me a file that
reproduces the problem, I will see if there is a way to avoid that error in
the future.

Remove "online" from my e-mail to get the actual address.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

VM

Hi,
I am not able to reach you on email.
i am getting the following return message

The following recipient(s) could not be reached:

(e-mail address removed) on 2/16/2006 1:59 PM
This message is larger than the current system limit or the
recipient's mailbox is full. Create a shorter message body or remove
attachments and try sending it again
 
M

Mark Nelson [MS]

That is a bit strange. I believe that you can send something upwards of
5MB. You might put everything into a ZIP file.

I was encountering a problem today with another customer where their
attachment was being stripped. Again the solution is to put the attachment
into a ZIP file.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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