CommandEnded SETVAR eventhandler

CommandEnded SETVAR eventhandler

SRSDS
Advisor Advisor
998 Views
4 Replies
Message 1 of 5

CommandEnded SETVAR eventhandler

SRSDS
Advisor
Advisor

Is there a way to check which variable is being modified?

0 Likes
Accepted solutions (1)
999 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant

Hi,

You should try the Application.SystemVariableChanged event.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 5

SRSDS
Advisor
Advisor

Ouch. I've probably spent 10 years of my spare time trying to put my app together, and have no idea what you mean by:

You should try the Application.SystemVariableChanged event.

How do I implement that?

0 Likes
Message 4 of 5

_gile
Consultant
Consultant
Accepted solution

Exactly the same as any other event handling, you add an handler to the event.

Application.SystemVariableChanged += Application_SystemVariableChanged;

and, for example:

        private void Application_SystemVariableChanged
            (object sender, Autodesk.AutoCAD.ApplicationServices.SystemVariableChangedEventArgs e)
        {
            if (e.Name == "CLAYER" && e.Changed)
                Application.ShowAlertDialog("Current layer changed") 
        }

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 5

SRSDS
Advisor
Advisor

Gile,

Thanks again,

Wasn't that used to application events but saw I had an OnIdle one.

And the & e.changed in your example is also helpful. 

0 Likes