Formatting of Rollover ToolTips in AutoCAD MEP and AutoCAD Architecture

Formatting of Rollover ToolTips in AutoCAD MEP and AutoCAD Architecture

Keith.Brown
Advisor Advisor
2,042 Views
4 Replies
Message 1 of 5

Formatting of Rollover ToolTips in AutoCAD MEP and AutoCAD Architecture

Keith.Brown
Advisor
Advisor

I have been attempting to follow this AutoCAD DEVBlog article on formatting rollover tooltips and I am running into issues.  Below is the exact code that I am using.  I have referenced accoremgd, acmgd, and acdbmgd.

 

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
namespace ToolTipFormatting
{
    public class Class1 : IExtensionApplication
    {
        void IExtensionApplication.Initialize()
        {
            Document activeDoc = Application.DocumentManager.MdiActiveDocument;
            activeDoc.Editor.PointMonitor += new PointMonitorEventHandler(Editor_PointMonitor);
        }
        void Editor_PointMonitor(object sender, PointMonitorEventArgs e)
        {
            if (e.Context.GetPickedEntities().Length > 0)
            {
                e.AppendToolTipText("Iam]]><LineBreak/><Bold>BOLD</Bold><LineBreak/>" +
                                "<![CDATA[Iam]]><LineBreak/><Italic>Italic</Italic>" +
                                "<LineBreak/><![CDATA[Iam Normal");
            }
        }
        void IExtensionApplication.Terminate()
        {
            Document activeDoc = Application.DocumentManager.MdiActiveDocument;
            if (activeDoc != null)
            {
                activeDoc.Editor.PointMonitor -= new PointMonitorEventHandler(Editor_PointMonitor);
            }
        }
    }
}

 

When i try this code in straight vanila AutoCAD that is started from a desktop shortcut it works fine.  If i start AutoCAD MEP or AutoCAD Architecture it fails and instead of displaying the tooltip it displays the text string inside of the e.appendtooltiptext method,  If i start AutoCAD MEP and switch to the AutoCAD profile it will not work. So it seems to me that something that is loaded when MEP and ACA is loaded is keeping the tooltip from formatting correctly.  Has anyone else ran into this?  Does anyone know of a workaround to fix this?  Hopefully it is just a format change to the text string.

 

Thanks!

0 Likes
Accepted solutions (2)
2,043 Views
4 Replies
Replies (4)
Message 2 of 5

Balaji_Ram
Alumni
Alumni
Accepted solution

Hi Keith,

 

I have seen this behavior earlier and this is already logged as a request with our engineering team.

Sorry, I haven't found any workaround to get this working in ACA.

 

Regards,



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

Keith.Brown
Advisor
Advisor

I kind of thought that would be the answer.  The good news is that i went ahead and monitored the tooltip opened event and when the tooltip was opened i just replaced the wpf control with my own.  I actually got better results using this method.  Thank you for taking the time to reply.

Message 4 of 5

Civil3DReminders_com
Mentor
Mentor

Was it easy to replace the WPF control? If so do you mind sharing how to do it? Civil 3D is built on ACA so I'm having the same issue showing the formatting. 

 

Thanks!

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
Message 5 of 5

Keith.Brown
Advisor
Advisor
Accepted solution

It was actually kind of easy once the process was understood.  I showed the code in a previous post which you can find at the link below.

 

https://forums.autodesk.com/t5/net/how-to-replace-autocad-rollover-tooltips-for-a-custom-wpf-user/m-...

 

I think that there is enough there to show everything but if you need more information let me know.  Good Luck!