Issue with Delete Key Removing TextNote Elements Instead of Characters in Revit API

Issue with Delete Key Removing TextNote Elements Instead of Characters in Revit API

msanhueza9R6PV
Explorer Explorer
321 Views
1 Reply
Message 1 of 2

Issue with Delete Key Removing TextNote Elements Instead of Characters in Revit API

msanhueza9R6PV
Explorer
Explorer

Hi, I have an issue with the Revit API.

 

I have implemented the delete command to remove some rebar elements once certain annotation elements are deleted. However, I'm encountering an issue where pressing the delete key within the text editor of any TextNote element deletes the entire element instead of the typed character. Is it possible to determine through the Revit API if the user is currently editing any text to avoid deleting the element and only delete the character instead?

 

Thanks in advanced.

0 Likes
Accepted solutions (1)
322 Views
1 Reply
Reply (1)
Message 2 of 2

Moustafa_K
Advisor
Advisor
Accepted solution

I am not sure if there is a direct or supported way yo access this, but i usually jump to UI status. Meaning, I check the Ribbons and tabs and predict what i need from how it looks. Not the perfect way, but it works for now. You can try this snippet

 

const string EDITTEXTTAB = "Edit TextTab";
var tabs = Autodesk.Windows.ComponentManager.Ribbon.Tabs;

for (int i = 0; i < tabs.Count; i++)
{
    var tab = tabs[i];
    if (tab.Id == EDITTEXTTAB)
    {
        // text is in edit mode
        break;
    }
}

 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1