Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Hints" for a GUI.HorizontalSlider?

Discussion in 'Immediate Mode GUI (IMGUI)' started by bigkahuna, Dec 10, 2007.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Is this possible? If so, how? :?
     
  2. podperson

    podperson

    Joined:
    Jun 6, 2006
    Posts:
    1,371
    Hints ... as in tickmarks or labels?

    Try a compound control.
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Sorry I wasn't very clear, I meant hints as in "tooltips".

    I know how to add tooltips to a button like this:

    Code (csharp):
    1. GUI.Button (Rect (10,10,100,20), GUIContent ("Click me", "This is the tooltip"));
    But how do I add it to a specific horizontal slider?

    Code (csharp):
    1. GUI.HorizontalSlider (Rect (120, 40, 100, 30), hSliderValue1, 100.0, 10.0);
     
  4. podperson

    podperson

    Joined:
    Jun 6, 2006
    Posts:
    1,371
    Ah! Problematic because of the lack of a proper event model :-/

    The same would apply to -- say -- providing a tooltip for a text label (e.g. explaining what it means).
     
  5. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    try puting an invisble box with your tootlip underneath the scrollbar

    GUI.HorizontalSlider ( Rect (10,10, 100, 20) ... )
    GUI.Box (Rect (10, 10, 100, 20), new GUIContent ("", "My Tooltip"), GUIStyle.none);
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Cool idea, thanks Nicholas!