AllenDang / giu

Cross platform rapid GUI framework for golang based on Dear ImGui.
MIT License
2.16k stars 128 forks source link

How to add tooltip to widget? #698

Closed mikigal closed 9 months ago

mikigal commented 9 months ago

Hello! I want to add tooltip to one of widgets (message which is displayed on hover). I found giu.Tooltip widget, but I have no idea how can I bind it to checkbox.

How can I do it?

gucio321 commented 9 months ago

just put tooltip after your widget.

package main

import (
    "github.com/AllenDang/giu"
    g "github.com/AllenDang/giu"
)

var content bool

func loop() {
    g.SingleWindow().Layout(
        giu.Checkbox("I'm a checkbox", &content),
        giu.Tooltip("I'm a tooltip!"),
    )
}

func main() {
    wnd := g.NewMasterWindow("Hello world", 400, 200, 0)
    wnd.Run(loop)
}
mikigal commented 9 months ago

Oh, I tried only adding it before checkbox Thanks for fast response!

Zrzut ekranu 2023-09-21 214612

gucio321 commented 9 months ago

No problem! issue speedrun :smile: