You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Enabling tool tips in a window](#enabling-tool-tips-in-a-window)
17
+
-[Using built-in tool tip widgets](#using-built-in-tool-tip-widgets)
18
+
-[Enabling tool tips in a PopUp](#enabling-tool-tips-in-a-popup)
19
+
-[Creating new tool tip widgets](#creating-new-tool-tip-widgets)
20
+
-[Extending existing widgets for tool tip support](#extending-existing-widgets-for-tool-tip-support)
6
21
22
+
## Overview
7
23
8
24
**fyne-tooltip** is an add-on package for Fyne adding tooltip support. It provides a tool tip rendering system, along with drop-in tooltip-enabled extensions of several of the Fyne builtin widgets, as well as an easy means to extend existing widgets to add tool tip support, or creating new tooltip-enabled custom widgets. It aims to be easy and low-friction to integrate into your existing Fyne projects, as well as easy to remove and switch back to Fyne core if and when tooltips are supported natively.
9
25
10
26
Tool tip widgets implement `desktop.Hoverable` to show the tool tips after a short delay on MouseIn, and hide them on MouseOut.
11
27
12
-
## Enabling tool tips in a window
28
+
## Demo
29
+
30
+
In the following video you can see how tooltips look with **fyne-tooltip** in a Fyne app. The source code is available at `cmd/example.go`.
This chapter explains how **fyne-tooltip** works and how to use it in your own Fyne apps.
67
+
68
+
### Enabling tool tips in a window
13
69
14
70
**fyne-tooltip** requires tool tip layers to be created for the tool tips to be rendered into, and provides APIs to do so for windows and pop-ups. It is called when setting the window's content:
Drop-in replacements for several built-in Fyne widgets are provided, which have been extended from the base implementation to add tool tip support.
33
89
@@ -46,7 +102,7 @@ func main() {
46
102
}
47
103
```
48
104
49
-
## Enabling tool tips in a PopUp
105
+
###Enabling tool tips in a PopUp
50
106
51
107
Similarly to windows, **fyne-tooltip** requires a tool tip layer to be created for pop ups to enable tool tips to be shown.
52
108
It is called after creating the pop up with content, but before showing it.
@@ -60,7 +116,7 @@ pop.Show()
60
116
The pop up may be hidden and re-shown. It is only necessary to create the pop up layer once. When the popup is hidden and will not be shown again,
61
117
it is important to call `DestroyPopUpToolTipLayer` to release memory resources associated with the tool tip layer.
62
118
63
-
## Creating new tool tip widgets
119
+
###Creating new tool tip widgets
64
120
65
121
To create custom widgets that are tool tip enabled, just extend from the `ToolTipWidget` base struct instead of `BaseWidget`. The widget will automatically
66
122
have a SetToolTip API, and the mouse event hooks added to show and hide the tool tip.
## Extending existing widgets for tool tip support
138
+
If your custom widget implements `desktop.Hoverable`, e.g. to make it tappable, you must also forward calls to `ToolTipWidget` in your overridden methods to enable tooltips to work. Here is an example for how this could be implemented:
Below is a complete example app that shows how to use **fyne-tooltips**. The source code of the example app shown in the video is also available at `cmd/example.go`.
0 commit comments