Author Topic: How do you use tooltip?  (Read 2024 times)

richardwood

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
How do you use tooltip?
« on: August 29, 2014, 02:15:45 PM »
Hey, is there a short tutorial on how to implement tooltip?
I've been tinkering around and confused. I want a tooltip appear when users hover to sprite and not moving cursor. So I put this on the sprite

  1. public void OnTooltip()
  2.     {
  3.         Debug.Log("triggered");
  4.     }

it does nothing.
need help Thanks!

Yukichu

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 8
  • Posts: 101
    • View Profile
Re: How do you use tooltip?
« Reply #1 on: August 29, 2014, 06:14:55 PM »
You have to roll your own for more options, but the basics are:

  1.     void OnTooltip(bool show)
  2.     {
  3.         if (show)
  4.         {
  5.             ShowText("Some text");
  6.         }
  7.         else
  8.         {
  9.             ShowText("");
  10.         }
  11.     }

Setting the value to empty string or null makes the tooltip go away.

richardwood

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: How do you use tooltip?
« Reply #2 on: August 30, 2014, 01:47:06 AM »
Thank you, that solved it  :)