Search Unity

On Active?

Discussion in 'Immediate Mode GUI (IMGUI)' started by alexander, Jul 23, 2008.

  1. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hi

    I've got a menu with 4 buttons.
    4 labels in white and black.

    So I thought, when the application for label 1 is active (it should be black) I have to set in the customStyles in "Active" the black label.
    But that wasn't it.
    So where's the error.
    Up to now, I've got at "normal" the white labels and in "hover" the black labels - works.
    But where have I got to set the black ones, when the appropriated app is running?

    Thx
    Alex
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    I don't quite understand your description of what you are doing. Could you post the relevant code snippet instead and describe what it is supposed to do?
     
  3. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hmm, it haven't much to do with the code...
    But for example
    Code (csharp):
    1.  
    2. if (GUILayout.Button("",GUI.skin.customStyles[7])) {
    3.    print("next");
    4.    SendMessage("next");
    5. }
    And for this button I've made 2 different-colored labels (black and white).
    In this customStyle I defined for "normal" the white
    and for "hover" and "active" the black one.
    But what I wanted is following:
    the attached pic is my menu - f.e. when I am in "Fotos" the black label should be active - I thought that's the point "Active" in the customStyle... but it isn't.

    What's the correct way to realize this?
     

    Attached Files:

  4. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    "active" is meant to be how it looks when the mouse is held on it. Like when you click a button or something.

    For your use you will have to change the normal property of the style from code as needed.

    -Jeremy
     
  5. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    No - unfortunately the "normal"-property wasn't it.

    But it have to be possible.
    Can I "override" the customStyles with a GUI.Button as long as the menupoint is active?
    How does this work?

    Or any other way?

    ___info___
    normal - white label
    hover - black label
    active - black label
    when this menu point is running - should be black, but how?

    Thx
    Alex
     
  6. Samantha

    Samantha

    Joined:
    Aug 31, 2005
    Posts:
    609
    If I understand correctly, you're asking how to change the font color of a button after you've clicked it and moved the mouse away? If you only want one button to be "selected" at a time, then you probably want to use GUI.Toolbar. Otherwise, you might want to use GUI.Toggle and pass a button-based style as the style parameter.