[Mono-bugs] [Bug 386504] New: Forms don't activate properly with the Carbon backend
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 4 10:23:37 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=386504
Summary: Forms don't activate properly with the Carbon backend
Product: Mono: Class Libraries
Version: 1.9.0
Platform: Macintosh
OS/Version: Mac OS X 10.4
Status: NEW
Severity: Major
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: jesjones at mindspring.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Form::Activate doesn't bring the window to the front and when forms are
activated (by clicking on a deactivated form for example) the activate and
deactivate events don't fire.
Here's a test case:
// compile with:
// gmcs -r:System.Windows.Forms.dll -out:app.exe FormActivation.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
internal class Program
{
public static void Main(string[] args)
{
DoInit();
Application.Run();
}
public static void DoInit()
{
ms_timer = new Timer();
DoCreateForm();
DoCreateForm();
ms_timer.Tick += DoTransition;
ms_timer.Interval = 3000;
ms_timer.Start();
}
private static void DoCreateForm()
{
Form form = new Form();
form.Text = "window " + ms_forms.Count;
form.Menu = new MainMenu();
form.Activated += DoActivated;
form.Deactivate += DoDeactivated;
MenuItem fileMenu = new MenuItem("File");
fileMenu.MenuItems.Add(0, new MenuItem("Quit", (s, e) =>
DoQuit()));
form.Menu = new MainMenu();
form.Menu.MenuItems.Add(fileMenu);
form.Visible = true;
ms_forms.Add(form);
}
private static void DoActivated(object sender, EventArgs e)
{
Form f = (Form) sender;
Console.WriteLine("activated {0}", f.Text);
++ms_activateCount;
}
private static void DoDeactivated(object sender, EventArgs e)
{
Form f = (Form) sender;
Console.WriteLine("deactivated {0}", f.Text);
++ms_deactivateCount;
}
private static void DoTransition(Object myObject, EventArgs myEventArgs)
{
if (ms_state == 0)
{
Console.WriteLine("0) activating form 0");
ms_forms[0].Activate();
ms_state = 1;
}
else if (ms_state == 1)
{
Console.WriteLine("1) activating form 1");
ms_forms[1].Activate();
ms_state = 2;
}
else
{
Console.WriteLine("2) checking");
// Should be one (or maybe even two activates on startup) plus two
from the timer.
// Should be zero (or maybe one deactivate on startup) plus two
from the timer.
if (ms_activateCount >= 3 && ms_deactivateCount >= 3)
{
Console.WriteLine("passed: got {0} activates and {1}
deactivates", ms_activateCount, ms_deactivateCount);
}
else if (ms_activateCount < 3 && ms_deactivateCount < 2)
{
Console.WriteLine("FAILED: expected at 3-4 activates, but got
{0} activates", ms_activateCount);
Console.WriteLine("FAILED: expected at 2-3 deactivates, but got
{0} deactivates", ms_deactivateCount);
}
else if (ms_activateCount < 3)
{
Console.WriteLine("FAILED: expected at 3-4 activates, but got
{0} activates", ms_activateCount);
}
else if (ms_deactivateCount < 2)
{
Console.WriteLine("FAILED: expected at 2-3 deactivates, but got
{0} deactivates", ms_deactivateCount);
}
DoQuit();
}
}
private static void DoQuit()
{
foreach (Form f in ms_forms)
f.Close();
ms_forms.Clear();
ms_timer.Stop();
Application.Exit();
}
private static Timer ms_timer;
private static List<Form> ms_forms = new List<Form>();
private static int ms_state;
private static int ms_activateCount;
private static int ms_deactivateCount;
}
--
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