Greetings,
How can I make a module that detects wether the text editing tab is open or not?
Best regards,
Ivan
Solved! Go to Solution.
Solved by augusto.goncalves. Go to Solution.
Solved by augusto.goncalves. Go to Solution.
You can track whenever the Tab is activated
For instance, from inside Initialize event
void IExtensionApplication.Initialize()
{
Autodesk.Windows.RibbonControl ribCtrl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl;
foreach(Autodesk.Windows.RibbonTab tab in ribCtrl.Tabs )
{
if (!string.IsNullOrWhiteSpace(tab.Id) && tab.Id.Contains("ID_MText_Tab"))
{
tab.Activated += tab_Activated;
}
}
}
void tab_Activated(object sender, EventArgs e)
{
// do something here...
}
This code is for C++, isn't it? How to do the same in Visual Basic 2010?
Actually is a C# code, and you can convert to VB.NET at http://www.developerfusion.com/tools/convert/csharp-to-vb/
Greetings, Augusto!
I've inserted your code in Microsoft Visual C# 2010 Express and it showed me three errors, particularly:
01. 'CSharp_Plugin.DetectingTab.IExtensionApplication.Initialize()': containing type does not implement interface 'Autodesk.AutoCAD.Runtime.IExtensionApplication'
02. The type or namespace name 'Windows' does not exist in the namespace 'Autodesk' (are you missing an assembly reference?)
03. The type or namespace name 'Ribbon' does not exist in the namespace 'Autodesk.AutoCAD' (are you missing an assembly reference?)
How can I fix these errors?
Best regards,
Ivan
using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; namespace CSharp_Plugin { public class DetectingTab { void IExtensionApplication.Initialize() { Autodesk.Windows.RibbonControl ribCtrl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl; foreach (Autodesk.Windows.RibbonTab tab in ribCtrl.Tabs) { if (!string.IsNullOrWhiteSpace(tab.Id) && tab.Id.Contains("ID_MText_Tab")) { tab.Activated += tab_Activated; } } } void tab_Activated(object sender, EventArgs e) { // do something here... } } }