Main Site Documentation

Radiobutton NullReferenceException


#1

Hi,

I have issues with using a radio button with Glide 1.0.0:

#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message: 
#### GHIElectronics.NETMF.Glide.UI.RadioButton::Render [IP: 0008] ####
#### GHIElectronics.NETMF.Glide.Display.DisplayObject::Invalidate [IP: 0005] ####
#### GHIElectronics.NETMF.Glide.UI.RadioButton::set_IsSelected [IP: 0016] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::LoadRadioButton [IP: 00ca] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::GetComponent [IP: 00a6] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::LoadWindow [IP: 00a9] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::LoadWindow [IP: 000b] ####

Window is:

<Glide Version="1.0.0">
  <Window Name="instance115" Width="320" Height="240" BackColor="FFFFFF">
    <RadioButton Name="staticRB" X="10" Y="10" Width="32" Height="32" Alpha="255" Value="static" IsSelected="True" GroupName="IPType" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <RadioButton Name="dhcpRB" X="142" Y="10" Width="32" Height="32" Alpha="255" Value="DHCP" IsSelected="False" GroupName="IPType" ShowBackground="True" Color="d4d4d4" OutlineColor="b8b8b8" SelectedColor="358bf6" SelectedOutlineColor="002dff"/>
    <Button Name="okBtn" X="122" Y="198" Width="80" Height="32" Alpha="255" Text="OK" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
  </Window>
</Glide>

Code is:

        static Window windowMain;
        static Window windowNet;

        public static void Main()
        {
            LCDSettings.SetBootSetup();

            // Load the window
            windowMain = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow));
            windowNet = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.NetWindow));

            // Activate touch
            GlideTouch.Initialize();

            // Initialize the window.
            windowMainInit();
            windowNewInit();

            // Assigning a window to MainWindow flushes it to the screen.
            // This also starts event handling on the window.
            Glide.MainWindow = windowMain;

            Thread.Sleep(Timeout.Infinite);
        }

Exception occurs on line:
GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.NetWindow));

Any ideas? If I remove the first row it displays - but with a radiobutton missing.

Thanks!


#2

ok. turns out you must have all radiobuttons as non-selected in a form definition.


#3

You just saved me a bunch of time by replying back what the problem was - this fixed my issue too, thank you!!


#4

Another good catch; this will be fixed.


#5

Please note that this is important for Checkboxes too in v 1.0.0.
You [italic]need[/italic] to set them to [italic]false[/italic] in the designer, otherwise loading fails.


#6

Just ran into this with CheckBox - still a bug in 1.0.2, too… :\


#7

In V 1.0.2 this issue is fixed for radio buttons but it is not fixed for checkboxes. The necessary changes will be made to address this issue.