The BalloonTip.OnClick event is not being raised

The BalloonTip.OnClick event is not being raised

Lukas_cp
Participant Participant
800 Views
5 Replies
Message 1 of 6

The BalloonTip.OnClick event is not being raised

Lukas_cp
Participant
Participant

I subscribe to the OnClick event of the BalloonTip. But when I click on the BalloonTip, the event handler method is not being called. What am I missing here?

 

_balloonTip = _inventorApplication.UserInterfaceManager.BalloonTips.Add
(
    InternalName: "BalloonTip",
    Title: "My balloon tip",
    Message: "This is a message"
);

_balloonTip.Enabled = true;
_balloonTip.Interval = 15;
_balloonTip.OnClick += BalloonTipOnClick;

 

 

0 Likes
Accepted solutions (1)
801 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @Lukas_cp.  I haven't used that specific event handler before, so I looked up under the BalloonTip object, to see the latest online help page for it, to see what it should look like.

BalloonTip.OnClick Event

Unfortunately, it doesn't show an example of what the 'handler' Sub should look like, or how it needs to be defined.  It just tells us about the one input variable called "Context" which is a NameValueMap, and about the only name value pair it currently recognizes.  And no link to a sample code using it either.  I'm guessing that since it calls its only variable an 'input', that you would have to create the NameValueMap variable ahead of time, then supply it to this Sub with ByRef, then the Sub will fill in a name/value pair.  Then you can see what if/what value it may have put into it after that sub has ran.  Is that how you have yours set up?

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

JhoelForshav
Mentor
Mentor

Hi @Lukas_cp 

I made a very simple test of this and didn't manage to raise the event either... This makes me think there's a bug here.

Maybe @MjDeck could bring some clarity to this problem?

This is the code I tested and clicking the balloontip didn't raise the event.

 

Imports Inventor
Public Class TestBalloonTip
    Dim invapp As Inventor.Application
    Private WithEvents bTip As BalloonTip
    Private Sub TestBalloonTip_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        invapp = GetObject(, "Inventor.Application")
        Dim UIManager As UserInterfaceManager = invapp.UserInterfaceManager
        bTip = UIManager.BalloonTips.Add("testName", "testTitle", "testMessage")
        bTip.Enabled = True
        bTip.Display()
    End Sub

    Private Sub bTip_OnClick(Context As NameValueMap) Handles bTip.OnClick
        MsgBox(Context.Value("HyperlinkIndex"))
    End Sub
End Class

 

 

The NameValueMap (Context) should just give you information if any hyperlink is clicked.

 

Name = "HyperlinkIndex", Value = Long. The Index of the hyper link that was clicked. If no hyper link is clicked, 0 is returned.

0 Likes
Message 4 of 6

MjDeck
Autodesk
Autodesk
Accepted solution

@JhoelForshav and @Lukas_cp ,
It looks like the OnClick event will not be raised unless your tip contains at least one hyperlink. This worked for me:

 

balloonTip1 = balloonTips.Add("Test379", "Test Tip", "This could be a useful message with a <Hyperlink>clickable area</Hyperlink>");

 

The tag name must be spelled Hyperlink. It's case-sensitive.
Then the event is raised if you click on the hyperlink text.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 6

WCrihfield
Mentor
Mentor

Thanks for clearing that up Mike.  You're the best.

It sure would be nice if someone were to recommend/cause the online help page for that event to get updated with this necessary information about it.  You know, someone highly knowledgeable on the subject, with influence on the Autodesk side.  🤔😉 (hint, wink, nod, nudge...)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

MjDeck
Autodesk
Autodesk

@WCrihfield , absolutely. We should be able to update the help in the next release.


Mike Deck
Software Developer
Autodesk, Inc.