none
Mutually Exclusive Check box RRS feed

  • General discussion

  • I'm writing a program for a class that requires us to use 3 check boxes but they need to be mutually exclusive. I am not sure on how to write the code so that they are mutually exclusive. Any help would be greatly appreciated.
    Sub ChkStandard_Click
      
      FCControls.SetChecked(ChkPlatinum, "False")
      FCControls.SetChecked(ChkGold, "False")
      rate = .005
      
    EndSub

    • Edited by Rosco2382 Tuesday, October 16, 2012 4:45 PM Found Solution
    • Changed type Rosco2382 Tuesday, October 16, 2012 4:58 PM Found Solution
    Tuesday, October 16, 2012 3:11 PM

All replies

  • Here is 3 mutually exclusive check boxes:

    checkbox[1] = FCControls.AddCheckBox("1")
    checkbox[2] = FCControls.AddCheckBox("2")
    checkbox[3] = FCControls.AddCheckBox("3")
    FCControls.SetChecked(checkbox[1],"True")
    FCControls.SetChecked(checkbox[2],"False")
    FCControls.SetChecked(checkbox[2],"False")
    FCControls.Move(checkbox[1],10,10)
    FCControls.Move(checkbox[2],40,10)
    FCControls.Move(checkbox[3],70,10)
    For i = 1 to 3
      FCControls.RegisterMouseUpEvent(checkbox[i],"Checked"+i)
    EndFor
    Sub Checked1
      If FCControls.GetChecked(checkbox[1]) = "True" Then
        For i = 2 To 3
          FCControls.SetChecked(checkbox[i],"False")
        EndFor
      Else
        For i = 2 To 3
          FCControls.SetChecked(checkbox[i],"True")
        EndFor
      EndIf
    EndSub
    Sub Checked2
      If FCControls.GetChecked(checkbox[2]) = "True" Then
        For i = 1 To 3 Step 2
          FCControls.SetChecked(checkbox[i],"False")
        EndFor
      Else
        For i = 1 To 3 Step 2
          FCControls.SetChecked(checkbox[i],"True")
        EndFor
      EndIf
    EndSub
    Sub Checked3
      If FCControls.GetChecked(checkbox[3]) = "True" Then
        For i = 1 To 2
          FCControls.SetChecked(checkbox[i],"False")
        EndFor
      Else
        For i = 1 To 2
          FCControls.SetChecked(checkbox[i],"True")
        EndFor
      EndIf
    EndSub

    Like this?


    I am a 10 year old that loves math, games, and computers. "Everyone is potentially great, you just have to turn it into kinetic greatness."

    Tuesday, October 16, 2012 10:18 PM