spvessel / spacevil

Simple examples of SpaceVIL implementation for C# / .NET Framework, C# / .NET Core and Java.
https://spvessel.com
MIT License
56 stars 7 forks source link

ButtonToggle_0 MouseRelease System.NullReferenceException: Object reference not set to an instance of an object. #12

Open arjOman opened 2 years ago

arjOman commented 2 years ago

I have no idea why MouseRelease throws a null reference exception. Here is the code:

            ButtonToggle menuItem = new ButtonToggle("Enable Combobox");
            menuItem.SetStyle(Style.GetMenuItemStyle());
            menuItem.SetTextMargin(new Indents(25, 0, 0, 0));

            menuItem.EventMouseClick += delegate
            {
                var e = new MessageBox();
                e.SetMessageText("Hey");
                e.Show();
            };

            AddItem(menuItem);