Hello,
I have some blocks which are placed with some routines in VB.net and are linked by a unique code to a external data file (XML-file). I want to try to created a kind of propertybox (in a toolpalette) which indicate some of this external data values. If one of these values are changed (by changing the values in the propertybox), some routines need to be executed.
So my question is, is it possible when a object is selected (not during a command), to run a piece of code (VB.NET). I have found some basic principles about "overruling" but I'm not sure this is the correct/possible way to solve the problem and I'm not there yet.
Can somebody help me with some sample code in VB.NET?
thx
Filip
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Solved by _gile. Go to Solution.
Here's a little sample.
C#
[CommandMethod("On")] public void On() { Document doc = AcAp.DocumentManager.MdiActiveDocument; doc.ImpliedSelectionChanged += new EventHandler(doc_ImpliedSelectionChanged); } [CommandMethod("Off")] public void Off() { Document doc = AcAp.DocumentManager.MdiActiveDocument; doc.ImpliedSelectionChanged -= new EventHandler(doc_ImpliedSelectionChanged); } void doc_ImpliedSelectionChanged(object sender, EventArgs e) { Document doc = (Document)sender; Editor ed = doc.Editor; PromptSelectionResult psr = ed.SelectImplied(); if (psr.Status == PromptStatus.OK) AcAp.ShowAlertDialog(string.Format("{0} selected entities", psr.Value.Count)); }
VB
<CommandMethod("On")> _ Public Sub [On]() Dim doc As Document = Application.DocumentManager.MdiActiveDocument AddHandler doc.ImpliedSelectionChanged, AddressOf doc_ImpliedSelectionChanged End Sub <CommandMethod("Off")> _ Public Sub Off() Dim doc As Document = Application.DocumentManager.MdiActiveDocument RemoveHandler doc.ImpliedSelectionChanged, AddressOf doc_ImpliedSelectionChanged End Sub Private Sub doc_ImpliedSelectionChanged(sender As Object, e As EventArgs) Dim doc As Document = DirectCast(sender, Document) Dim ed As Editor = doc.Editor Dim psr As PromptSelectionResult = ed.SelectImplied() If psr.Status = PromptStatus.OK Then Application.ShowAlertDialog(String.Format("{0} selected entities", psr.Value.Count)) End If End Sub