Search Unity

GUI toggles as toolbars question

Discussion in 'Immediate Mode GUI (IMGUI)' started by half_voxel, Jan 8, 2008.

  1. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hello.

    I'm trying to make 6 toggles so you can chose different Textures on an object,
    but you shall not be able to have 2 toggles pressed at the same time (if you click another then the one that you have pressed it shall be pressed and the one that before was pressed shall be un-pressed <= THE PROBLEM!!(i can't do that)). i know there is tollbars but i can't use the because i have them in 2 rows and it looks nicer with toggles.


    do you know any thing that might be to help?
     
  2. rockstrongo

    rockstrongo

    Joined:
    Jan 7, 2008
    Posts:
    38
    not too sure about Unity GUI as I'm new to the framework - however in most OS's the equivalent of toggled checkboxes are radio buttons...
     
  3. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    You could make a script that simulate the effect of radio buttons using a collection of toggle buttons and some careful state switching.
     
  4. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    What you probably want to look at is the SelectionGrid - that will allow you to do a grid. (a toolbar is just a shortcut to create a one-row grid). You can pass in "toggle" as the style parameter to make them look like toggles.
     
  5. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Thanks.

    The selection grid was the thing i was looking for.
    but can i make the space between them bigger?