Main Site Documentation

Radio Button - How to use them


#1

I have three of them that I want to use to setup a camera to be streaming, photo, or off, is there an example of documentation on how to use Radio Buttons in Glide?

Thanks


#2

An example from when I used it…

The glide file:

<Glide Version="1.0.3">
  <Window Name="characterWindow" Width="320" Height="240" BackColor="FFFFFF">
    <TextBlock Name="nameLabel" X="0" Y="19" Width="50" Height="20" Alpha="255" Text="Name:" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBox Name="nameTextBox" X="54" Y="12" Width="245" Height="32" Alpha="255" Text="" TextAlign="Left" Font="2" FontColor="000000"/>
    <Button Name="rollButton" X="100" Y="67" Width="100" Height="32" Alpha="255" Text="Roll Stats" Font="2" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBlock Name="strLabel" X="0" Y="50" Width="70" Height="20" Alpha="255" Text="Strength:" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="strValue" X="75" Y="50" Width="30" Height="20" Alpha="255" Text="00" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="dexLabel" X="0" Y="90" Width="70" Height="20" Alpha="255" Text="Dexterity:" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="dexValue" X="75" Y="90" Width="30" Height="20" Alpha="255" Text="00" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="intLabel" X="0" Y="70" Width="75" Height="20" Alpha="255" Text="Intelligence:" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="intValue" X="75" Y="70" Width="30" Height="20" Alpha="255" Text="00" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="portraitLabel" X="247" Y="50" Width="45" Height="20" Alpha="255" Text="Portrait" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <Image Name="portraitImage" X="225" Y="65" Width="90" Height="110" Alpha="255"/>
    <TextBlock Name="raceLabel" X="76" Y="105" Width="35" Height="20" Alpha="255" Text="Race" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="humanLabel" X="35" Y="130" Width="50" Height="20" Alpha="255" Text="Human" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <RadioButton Name="humanRadioButton" X="0" Y="120" Width="32" Height="32" Alpha="255" Value="human" Checked="True" GroupName="raceRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <TextBlock Name="dwarfLabel" X="135" Y="130" Width="50" Height="20" Alpha="255" Text="Dwarf" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <RadioButton Name="dwarfRadioButton" X="100" Y="120" Width="32" Height="32" Alpha="255" Value="dwarf" Checked="False" GroupName="raceRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <TextBlock Name="gnomeLabel" X="135" Y="165" Width="50" Height="20" Alpha="255" Text="Gnome" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <RadioButton Name="gnomeRadioButton" X="100" Y="155" Width="32" Height="32" Alpha="255" Value="gnome" Checked="False" GroupName="raceRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <TextBlock Name="elfLabel" X="35" Y="165" Width="50" Height="20" Alpha="255" Text="Elf" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>    
    <RadioButton Name="elfRadioButton" X="0" Y="155" Width="32" Height="32" Alpha="255" Value="elf" Checked="False" GroupName="raceRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <TextBlock Name="sexLabel" X="80" Y="185" Width="35" Height="20" Alpha="255" Text="Sex" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="maleLabel" X="35" Y="207" Width="50" Height="20" Alpha="255" Text="Male" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <RadioButton Name="maleRadioButton" X="0" Y="200" Width="32" Height="32" Alpha="255" Value="male" Checked="True" GroupName="sexRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <TextBlock Name="femaleLabel" X="135" Y="207" Width="50" Height="20" Alpha="255" Text="Female" TextAlign="Left" TextVerticalAlign="Top" Font="2" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <RadioButton Name="femaleRadioButton" X="100" Y="200" Width="32" Height="32" Alpha="255" Value="female" Checked="False" GroupName="sexRadioButtonGroup" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <Button Name="classButton" X="225" Y="200" Width="90" Height="32" Alpha="255" Text="Select Class" Font="2" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
  </Window>
</Glide>

The Code that uses it.


           // Get the races
            RadioButton humanRadio = (RadioButton)characterGenWindow.GetChildByName("humanRadioButton");
            RadioButton dwarfRadio = (RadioButton)characterGenWindow.GetChildByName("dwarfRadioButton");
            RadioButton elfRadio = (RadioButton)characterGenWindow.GetChildByName("elfRadioButton");
            RadioButton gnomeRadio = (RadioButton)characterGenWindow.GetChildByName("gnomeRadioButton");
            
           // add a tap event for all the Race radio buttons (To the same event handler)
            humanRadio.TapEvent += new OnTap(raceRadio_TapEvent);
            dwarfRadio.TapEvent += new OnTap(raceRadio_TapEvent);
            elfRadio.TapEvent += new OnTap(raceRadio_TapEvent);
            gnomeRadio.TapEvent += new OnTap(raceRadio_TapEvent);

        void raceRadio_TapEvent(object sender)
        {
            characters[currentCharacter].race = RadioButtonManager.GetValue("raceRadioButtonGroup");
            resetPortrait();
        }



#3

@ jasuk70 cool, I missed the Value for each radiobutton, thanks.

When I look at the online Glide Documentation all I see is this so its not much help.


#4

You might have the same issue as others where you need to turn Compatibility View mode in IE.

http://www.tinyclr.com/forum/topic?id=11278