-
Notifications
You must be signed in to change notification settings - Fork 128
Tooltips
Tooltips are widgets that appear bellow other widget after user hover mouse pointer on that other widget. Showcase
Tooltip can be attached to any actor, only one tooltip can be attached to actor at the same time.
Creating tooltip for label:
VisLabel labelWithTooltip = new VisLabel("label with tooltip");
new Tooltip(labelWithTooltip, "this label has a tooltip");
Dettaching any tooltip from actor:
Tooltip.removeTooltip(someActor)
As you can see tooltips are not part of actor (i.e. method like actor.setTooltip(...)
does not exist). Tooltips works by attaching listener to target actor, if you remove that listener from actor(for example by calling actor.clearListeners()
) then you have to attach tooltip again by calling tooltip.attach()
, you can also remove tooltip manually by calling tooltip.detach(),
Tooltip target can be changed by calling tooltip.setTarget(Actor newTarget)
, this will automatically detach tooltip from old target and attach it to new target.
VisImageButton has constructor that allows to add tooltip along side with button icon, for example:
VisImageButton exploreButton = new VisImageButton(Assets.getIcon("folder-open"), "Explore");
VisImageButton settingsButton = new VisImageButton(Assets.getIcon("settings-view"), "Change view");
VisImageButton importButton = new VisImageButton(Assets.getIcon("import"), "Import");
(Assets
class is part of VisEditor, getIcon(...)
returns Drawable
)
See README for VisUI introduction.