Application idle event handler used to run undo command results in an eInvalidInput error

Application idle event handler used to run undo command results in an eInvalidInput error

ChristianBlei
Advisor Advisor
370 Views
1 Reply
Message 1 of 2

Application idle event handler used to run undo command results in an eInvalidInput error

ChristianBlei
Advisor
Advisor

Hello,

 

I try to "undo" the previous command be running an editor command "undo" in an application idle event. I get an eInvalidInput error.

What is the reason for this error and is there a way to avoid it?

I attached the handler inside of  a database_modified eventhandler where I check if I want to use the "undo".

 

My code:

 

private static void AcApplication_Idle(object sender, EventArgs e)
{
AcApplication.DocumentManager.MdiActiveDocument.Editor.Command("_.undo", "1");
}

 

Thanks for helping!

 

 

Christian Blei
CBT Christian Blei Tools
christianblei.de
youtube.com/channel/UCxjA_NbeScQy9C0Z1xjwXpw
0 Likes
371 Views
1 Reply
Reply (1)
Message 2 of 2

ChristianBlei
Advisor
Advisor

I searched again and found a couple of threads pointing in the correct direction. It is not possible to use Editor.Command in an application context. So I tried SendStringToExecute, which is working.

Christian Blei
CBT Christian Blei Tools
christianblei.de
youtube.com/channel/UCxjA_NbeScQy9C0Z1xjwXpw
0 Likes