User interface toolkit for Go with support for SDL2 and HTML Canvas render targets.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
736 B

  1. package ui_test
  2. import "git.kirsle.net/go/ui"
  3. // Tooltip usage example.
  4. func ExampleTooltip() {
  5. mw, err := ui.NewMainWindow("Tooltip Example", 800, 600)
  6. if err != nil {
  7. panic(err)
  8. }
  9. // Add a widget that will have a tooltip attached, i.e. a button.
  10. btn := ui.NewButton("My Button", ui.NewLabel(ui.Label{
  11. Text: "Hello world!",
  12. }))
  13. mw.Place(btn, ui.Place{
  14. Center: true,
  15. Middle: true,
  16. })
  17. // Add a tooltip to it. The tooltip attaches itself to the button's
  18. // MouseOver, MouseOut, Compute and Present handlers -- you don't need to
  19. // place the tooltip inside the window or parent frame.
  20. ui.NewTooltip(btn, ui.Tooltip{
  21. Text: "This is a tooltip that pops up\non mouse hover!",
  22. Edge: ui.Right,
  23. })
  24. mw.MainLoop()
  25. }