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

Didier9

Well-Known Member
Licensed User
Longtime 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.
 

Daestrum

Expert
Licensed User
Longtime User
If you want to remove the tooltip this code will do it
B4X:
 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
 
Upvote 0

Didier9

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0
Top