Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created my own tool palette. When that tool palette is visible I want to populate it with information from selecting a pline.
I have it somewhat working but not exactly the way that I would like it to..
Currently, I click on pline and I am prompted to select an object. I then select the pline and I have to hit enter in order for a text box on the palette to receive the layer of the pline.
How can I make it so I only have the select the pline just once for the info to show?
Here is my current code located within the palette code...
void doc_ImpliedSelectionChanged(object sender, EventArgs e)
{
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
{
Transaction tr = db.TransactionManager.StartTransaction();
using (tr)
{
PromptSelectionResult acPSR = ed.GetSelection();
if (acPSR.Value.Count == 1 && acPSR.Status == PromptStatus.OK)
{
SelectionSet acSSet = acPSR.Value;
foreach (SelectedObject acSObj in acSSet)
{
Polyline pl = (Polyline)tr.GetObject(acSObj.ObjectId, OpenMode.ForRead);
if (pl != null)
{
//ed.WriteMessage(pl.Layer + "\n");
textBox1.Text = pl.Layer;
}
}
}
// Committing is cheaper than aborting
tr.Commit();
}
}
}//void doc_ImpliedSelectionChanged
Thanks
Solved! Go to Solution.