Jump to content
Developer Wiki and Function Reference Links ×

Import Symbol during a Tool's DoModeEvent throws "Beta Undo Alert 9"


Recommended Posts

Hi,

we are trying to import a symbol while handling a ToolModeMessage (VWTool_EventSink::DoModeEvent).
That seems to work. However Vectorworks complains shortly afterwards with this message:


"Beta Undo Alert 9. The Undo System is thrown-off by last action".

Is it allowed to import a symbol during a ToolModeMessage?
If yes, any hints on what we could do to satisfy the Undo System?

Best Regards,
Matthias Ganninger

 

Link to comment

Hi Stefan,

 

thanks for your answer.

 

Explicitly starting an Undo Event before the import seems to help, as long as I do not end it explicitly.
When I try to end the Undo event after the import (by calling ISDK::EndUndoEvent) the error comes back.

If I leave the Undo step open it seems to work nearly perfect.

 

Our intention with that code was to temporarily import a symbol to read and cache some data.
So we were trying to get around the Undo system by not adding the imported object to it (because we immediately delete it before we are finished handling VWTool_EventSink::DoModeEvent).

 

Our solution for now is to start an UndoEvent for the Import and roll it back after we are finished (by calling ISDK::UndoAndRemove).
This seems to work.

Is this a good idea to do while handling the tool event VWTool_EventSink::DoModeEvent ?

Link to comment
On 10/9/2018 at 5:14 AM, Matthias Ganninger said:

Our solution for now is to start an UndoEvent for the Import and roll it back after we are finished (by calling ISDK::UndoAndRemove).
This seems to work.

Is this a good idea to do while handling the tool event VWTool_EventSink::DoModeEvent ?

Yes, this is the preferred technique.  I do find figuring out which events have built in undo events and which don't a bit of a challenge.

 

The mode bar event does not normally have an undo event attached, as it doesn't usually modify the drawing or data, so it needs an undo event if you are importing a symbol or changing a preference record (i.e. you are coding what happens when the user presses the preferences button as opposed to relying on the default mode bar implementation).  You'll notice that if you switch modes, then undo, the mode button does not undo.

 

You'll want to call

SupportUndoAndRemove()

SetUndoMethod(kUndoSwapObjects)

.. do your importing and extracting ..

UndoAndRemove()

 

Importing symbols ImportSelectedResource includes a call to AddAfterSwapObject(),  so you don't need to add that manually.

 

Unless you're just storing the data in a static variable, before you write the cache data to the file, you want to start another undo event 

SetUndoMethod(kUndoSwapObjects) do your store, and end the undo event.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...