[Mono-bugs] [Bug 341314] System.ArgumentException: Cannot activate invisible or disabled control

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 14 09:40:41 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=341314#c4





--- Comment #4 from Ian Walker <walker_643 at yahoo.com>  2007-11-14 07:40:41 MST ---
Got it.  Here's your test case:

--- main.cs ---

using System;
using System.Drawing;
using System.Windows.Forms;

namespace TestCase2
{
        public class FormMain : Form
        {
                Panel panel = new Panel();
                Button doneButton = new Button();
                Button popupButton = new Button();

                public FormMain()
                {               
                        this.Location = new Point(300, 200);
                        this.Size = new Size(200, 150);         

                        panel.Location = new Point(0, 0);
                        panel.Size = this.ClientSize;
                        panel.Visible = true;
                        this.Controls.Add(panel);

                        doneButton.Location = new Point(50, 20);
                        doneButton.Size = new Size(100, 30);
                        doneButton.Text = "Done";
                        doneButton.Click += new EventHandler(delegate {
this.Close(); });
                        doneButton.Visible = true;
                        this.panel.Controls.Add(doneButton);

                        popupButton.Location = new Point(50, 75);
                        popupButton.Size = new Size(100, 30);
                        popupButton.Text = "Popup";
                        popupButton.Visible = true;
                        popupButton.Click += new EventHandler(delegate {
                                this.panel.Controls.Remove(popupButton);
                                popupButton.Hide();
                                popupButton.Dispose();
                                popupButton = null;
                                (new FormBlah()).Show();                        
                        });
                        this.panel.Controls.Add(popupButton);
                }
        }

        public class FormBlah : Form
        {
                Button crashButton = new Button();

                public FormBlah()
                {
                        this.Location = new Point(500, 400);
                        this.Size = new Size(200, 150);

                        crashButton.Location = new Point(50, 20);
                        crashButton.Size = new Size(100, 30);
                        crashButton.Text = "Crash";
                        crashButton.Click += new EventHandler(delegate {
this.Close(); });
                        crashButton.Visible = true;
                        this.Controls.Add(crashButton);
                }               
        }

        public static class Program
        {
                public static int Main()
                {
                        Application.Run(new FormMain());
                        return (0);
                }
        }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list