Author Topic: Radio Button Root funcationailty with multiple roots  (Read 3895 times)

CoderBear

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
    • View Profile
Radio Button Root funcationailty with multiple roots
« on: May 28, 2013, 05:33:06 PM »
Hi there, I know that you can do radio button root and it will affect multiple check boxes.  However I need to do it with multiple roots but not sure how to go about this.

For example if item 1 is checked, and the Item 3 is pressed and becomes checked, item 1 goes off, and if then item 5 is pressed, item 3 goes off.

My hierarchy looks like this
-UiGrid
  -Item1 (not a pane)
    - Checkbox
  -Item2 (not a pane)
    - Checkbox
  -Item3 (not a pane)
    - Checkbox
  -Item4 (not a pane)
    - Checkbox
  -Item5 (not a pane)
    - Checkbox
  -Item6 (not a pane)
    - Checkbox

yet RadioButtonRoot can only be attached to a single item.

I had tried to do this, but it does't do anything.
  1. void EquipAndy()
  2.     {
  3.         string itemId = AndysApplesAssets.ANDY_GOOD.ItemId;
  4.  
  5.         if (andy.equipCheck.isChecked)
  6.         {
  7.             if (!StoreInventory.IsVirtualGoodEquipped(itemId))
  8.             {
  9.                 StoreInventory.EquipVirtualGood(itemId);
  10.                 kelly.equipCheck.isChecked = false;
  11.                 ninja.equipCheck.isChecked = false;
  12.                 pig.equipCheck.isChecked = false;
  13.                 pirate.equipCheck.isChecked = false;
  14.                 wizard.equipCheck.isChecked = false;
  15.             }
  16.         }
  17.     }

Any and all help will be greatly appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Radio Button Root funcationailty with multiple roots
« Reply #1 on: May 28, 2013, 05:54:41 PM »
Have the checkboxes trigger a function on the target. In this function do your check/uncheck logic based on UICheckbox.current that was checked.

CoderBear

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
    • View Profile
Re: Radio Button Root funcationailty with multiple roots
« Reply #2 on: May 28, 2013, 06:17:21 PM »
What exactly do you mean?  That is what the code above is trying to do and it is not working.  It might help if there was a visual reference to refer to.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Radio Button Root funcationailty with multiple roots
« Reply #3 on: May 29, 2013, 12:00:29 PM »
The root should be set to nothing, and your callback function is missing a state -- a boolean value gets passed indicating the state of the checkbox. Other than that its fine. Setting isChecked will change the checkbox's state.