Author: jackson
Date: 2006-07-11 08:06:56 -0400 (Tue, 11 Jul 2006)
New Revision: 62436
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
Log:
* Control.cs: When hiding a control only select the next control
if the current control was focused.
- Don't handle enter/leave when setting/killing focus, this is
done by the container control.
- Remove is_selected, it's not needed anymore.
- Add utility methods for selecting a child control, and for
firing the Enter/Leave events.
* ContainerControl.cs: When a control is activated fire the
enter/leave events.
- Don't wrap when processing the tab key, so that focus can be
moved outside of the container.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-07-11 11:39:11 UTC (rev 62435)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-07-11 12:06:56 UTC (rev 62436)
@@ -1,5 +1,19 @@
2006-07-11 Jackson Harper <[EMAIL PROTECTED]>
+ * Control.cs: When hiding a control only select the next control
+ if the current control was focused.
+ - Don't handle enter/leave when setting/killing focus, this is
+ done by the container control.
+ - Remove is_selected, it's not needed anymore.
+ - Add utility methods for selecting a child control, and for
+ firing the Enter/Leave events.
+ * ContainerControl.cs: When a control is activated fire the
+ enter/leave events.
+ - Don't wrap when processing the tab key, so that focus can be
+ moved outside of the container.
+
+2006-07-11 Jackson Harper <[EMAIL PROTECTED]>
+
* ComboBox.cs: Remove some debug code that was blinding me.
* UpDownBase.cs: These controls actually aren't implicit, they are
visible to the user.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
2006-07-11 11:39:11 UTC (rev 62435)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
2006-07-11 12:06:56 UTC (rev 62436)
@@ -27,6 +27,7 @@
// NOT COMPLETE
+using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
@@ -67,23 +68,81 @@
return;
}
- active_control = value;
-
+
if (!Contains(value) && this != value) {
throw new ArgumentException("Not a
child control");
}
+ if (value == this) {
+
+ }
+
+ // Fire the enter and leave events if possible
+ Form form = FindForm ();
+ if (form != null) {
+ Control common_container =
GetCommonContainer (form.ActiveControl, value);
+ ArrayList chain = new ArrayList ();
+ Control walk = active_control;
+
+ // Generate the leave messages
+ walk = active_control;
+ while (walk != common_container) {
+ walk.FireLeave ();
+ walk = walk.Parent;
+ }
+
+ walk = value;
+ while (walk != common_container) {
+ chain.Add (walk);
+ walk = walk.Parent;
+ }
+
+ for (int i = chain.Count - 1; i >= 0;
i--) {
+ walk = (Control) chain [i];
+ walk.FireEnter ();
+ }
+ }
+
+ active_control = value;
+
+
if (this is Form)
CheckAcceptButton();
-
+
// Scroll control into view
ScrollControlIntoView(active_control);
// Let the control know it's selected
- Select(value);
+// value.is_selected = true;
+// if (value.IsHandleCreated) {
+// XplatUI.SetFocus (value.window.Handle);
+// }
+
+ SelectChild (value);
}
}
+ // Just in a separate method to make debugging a little easier,
+ // should eventually be rolled into ActiveControl setter
+ private Control GetCommonContainer (Control active_control,
Control value)
+ {
+ Control new_container = null;
+ Control prev_container = active_control;
+
+ while (prev_container != null) {
+ new_container = value.Parent;
+ while (new_container != null) {
+ if (new_container == prev_container)
+ return new_container;
+ new_container = new_container.Parent;
+ }
+
+ prev_container = prev_container.Parent;
+ }
+
+ return null;
+ }
+
#if NET_2_0
public SizeF AutoScaleDimensions {
get {
@@ -319,7 +378,7 @@
}
protected virtual bool ProcessTabKey(bool forward) {
- return SelectNextControl(active_control, forward, true,
true, true);
+ return SelectNextControl(active_control, forward, true,
true, false);
}
protected override void Select(bool directed, bool forward) {
@@ -366,6 +425,21 @@
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected override void WndProc(ref Message m) {
+ switch ((Msg) m.Msg) {
+/*
+ case Msg.WM_LBUTTONDOWN:
+ OnMouseDown (new MouseEventArgs
(FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int)
m.LParam.ToInt32 ()),
+ HighOrder ((int) m.LParam.ToInt32 ()),
0));
+ return;
+*/
+ case Msg.WM_SETFOCUS:
+ if (active_control == null)
+ SelectNextControl (null, true, true,
true, false);
+ break;
+ case Msg.WM_KILLFOCUS:
+ break;
+ }
base.WndProc(ref m);
}
#endregion // Protected Instance Methods
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches