B4J Question Label TooltipText shows up even if set to an empty string [solved]

Discussion in 'B4J Questions' started by Didier9, May 21, 2019.

Tags:
  1. Didier9

    Didier9 Active Member Licensed User

    This is strange. If I create a label and never define a TooltipText, the tooltip does not show up at all. If I define the TooltipText as an empty string "", it shows up as a small empty tooltip.

    In my project, I change the value of the tooltiptext depending on what the program is doing so sometimes I redefine a tooltiptext to an empty string but then it shows the small empty box. If I define it as the B4J Null (no quotes), then it shows up as "Null" :)

    I must be missing something.
     
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    If you want to remove the tooltip this code will do it
    Code:
    Dim RemoveToolTip As JavaObject
     
    Dim theNode As JavaObject = lab ' the node with the tooltip
     RemoveToolTip.InitializeNewInstance("javafx.scene.control.Tooltip",Null)
     RemoveToolTip.RunMethod(
    "uninstall",Array(lab,theNode.RunMethod("getTooltip",Null)))
    If later you want to add one back, just use the tooltiptext method as normal
     
    Didier9 likes this.
  3. Didier9

    Didier9 Active Member Licensed User

    Great, thank you very much!
    I definitely would not have found that one by myself...
    But at least I understand what it does, it replaces the label with a new one.
    I tried it on a button and it works too.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice