Showing Rounded Rectangle ToolTip

Hi community,

I want to show a tooltip inside a rounded rectangle, but whenever I try to bind the rounded rectangle shape with the toolTip, it’s not coming up properly!

function getValue(go, dispatch, $) {
    return $(go.Adornment, "Spot",
        $(go.Placeholder, {
            padding: 32
        }),
        /*$(go.Shape, "RoundedRectangle", {
            height: 10,
            width: 30
        }),*/
        $(go.TextBlock, {
                //background: "black",
                alignment: go.Spot.Top,
                alignmentFocus: go.Spot.Top,
                stroke: "#0f1b54",//"white",
                verticalAlignment: go.Spot.Center
            },
            new go.Binding("text", "name", function(name) {
                return name;
            }))
    );
}

You don’t say and show what you want instead, so I have to guess.

The padding on the Placeholder is very large. Make it smaller, or don’t set it at all (zero is the default). Specify any desired spacing in the alignment of the second element.

No, I can’t make the padding 0, or else the tooltip would be shown exactly on the link label!

I’ve one more question, can this tooltip be hidden upon clicking escape button?

Sure:

    $(go.Diagram, . . .,
      { . . .,
        "toolManager.doCancel": function() {  // method override must be function, not =>
          this.hideToolTip();
          go.ToolManager.prototype.doCancel.call(this);
        }
      })

how exactly it will stop hiding upon clicking on esc button! can you show that code too? like where to write that e.keyCode == 27 condition!

GoJS Commands -- Northwoods Software
CommandHandler | GoJS API
Did you try it?

yes tried! not a success.

That’s odd – it worked for me when I modified the Basic sample, Basic GoJS Sample

It seems that you are implying that you have set a breakpoint in the method override, and that it is not reached when the user presses the Escape key. Is that correct?

If so, maybe you overrode the method and then replaced the Diagram.toolManager? That is uncommon, but it is infrequently needed. Just override the method after replacing the ToolManager. Usually that happens if you have defined a separate subclass of ToolManager. If that is the case, override doCancel in that subclass instead of doing so dynamically as I did in the code above.