TEXTEDIT Commandended handler not working in 2017

TEXTEDIT Commandended handler not working in 2017

SRSDS
Advisor Advisor
935 Views
5 Replies
Message 1 of 6

TEXTEDIT Commandended handler not working in 2017

SRSDS
Advisor
Advisor

Hi,

 

For some reason the commandended event handler is not reacting to the TEXTEDIT command in AutoCAD 2017 (and VS2015).

Other events react but not TEXTEDIT for some reason. And it reacts on previous versions of Autocad just not 2017.

Has there been a change in 2017 where I need to use a different reactor for this event?

 

0 Likes
Accepted solutions (1)
936 Views
5 Replies
Replies (5)
Message 2 of 6

FRFR1426
Collaborator
Collaborator

It works for me when I use ArxDbg (in the context menu, Reactors, System, Editor Reactor, On).

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 3 of 6

SRSDS
Advisor
Advisor

I didn't know about this feature of ArxDbg before. Thanks for showing me that.

 

It does react to the event but not the Command Ended event for some reason.

 

So I do see:

[ED REACTOR]    : [Command Will Start: TEXTEDIT]

 

Do you get a command ended event? 

0 Likes
Message 4 of 6

FRFR1426
Collaborator
Collaborator

Yes, I've a command ended event. Please note that if the command is canceled, the command ended event will be replaced by a command canceled event.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 5 of 6

_gile
Consultant
Consultant

Hi,

 

I made a simple try and it works for me

 

        private bool handled;

        [CommandMethod("CMDENDEDTOGGLE")]
        public void CmdEndedToggle()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            if (handled)
                doc.CommandEnded -= Doc_CommandEnded;
            else
                doc.CommandEnded += Doc_CommandEnded; 
            handled = !handled;
            doc.Editor.WriteMessage($"\nCommandEnded event handled = {handled}");
        }

        private void Doc_CommandEnded(object sender, CommandEventArgs e)
        {
            if (e.GlobalCommandName == "TEXTEDIT")
            AcAp.ShowAlertDialog("TEXTEDIT command ended.");
        }

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 6 of 6

SRSDS
Advisor
Advisor
Accepted solution

I understand what's going on now.

 

I have the TEXTEDIT mode set to multiple instead of single. 

 

The TEXTEDIT command allows you to edit multiple pieces of text one after the other.

You can press ESCAPE when you're done editing. Or you can press ENTER to complete the command.

 

ESCAPE triggers the CommandCanceled event rather than registering that a command has been completed.

ENTER does trigger CommandEnded.

 

Maybe this was the case in previous AutoCAD and I just didn't realize it.

 

I'll trap the event in both Cancelled and Ended. Or get the program to change the edit mode to single.

 

Thankyou for the hints!

 

 

 

 

0 Likes