Author: jackson
Date: 2006-07-11 08:21:10 -0400 (Tue, 11 Jul 2006)
New Revision: 62437
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.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.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2006-07-11 12:06:56 UTC (rev 62436)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2006-07-11 12:21:10 UTC (rev 62437)
@@ -69,7 +69,6 @@
internal bool is_visible; // true
if control is visible
internal bool is_entered; // is
the mouse inside the control?
internal bool is_enabled; // true
if control is enabled (usable/not grayed out)
- internal bool is_selected; // true
if control is selected
internal bool is_accessible; // true
if the control is visible to accessibility applications
internal bool is_captured; //
tracks if the control has captured the mouse
internal bool is_toplevel; //
tracks if the control is a toplevel window
@@ -945,8 +944,6 @@
return false;
}
- control.is_selected = true;
-
container = GetContainerControl();
if (container != null) {
container.ActiveControl = control;
@@ -957,6 +954,12 @@
return true;
}
+ internal void SelectChild (Control control)
+ {
+ if (control.IsHandleCreated)
+ XplatUI.SetFocus (control.window.Handle);
+ }
+
internal virtual void DoDefaultAction() {
// Only here to be overriden by our actual controls;
this is needed by the accessibility class
}
@@ -1109,6 +1112,16 @@
}
+ internal void FireEnter ()
+ {
+ OnEnter (EventArgs.Empty);
+ }
+
+ internal void FireLeave ()
+ {
+ OnLeave (EventArgs.Empty);
+ }
+
internal virtual bool ProcessControlMnemonic(char charCode) {
return ProcessMnemonic(charCode);
}
@@ -3109,7 +3122,7 @@
public bool SelectNextControl(Control ctl, bool forward, bool
tabStopOnly, bool nested, bool wrap) {
Control c;
-
+
c = ctl;
do {
c = GetNextControl(c, forward);
@@ -3640,7 +3653,7 @@
OnVisibleChanged(EventArgs.Empty);
- if (value == false && parent != null) {
+ if (value == false && parent != null &&
Focused) {
Control container;
// Need to start at parent,
GetContainerControl might return ourselves if we're a container
@@ -3883,7 +3896,7 @@
}
case Msg.WM_LBUTTONDOWN: {
- if (CanSelect && !is_selected) {
+ if (CanSelect) {
Select(this);
}
InternalCapture = true;
@@ -4085,7 +4098,6 @@
}
case Msg.WM_KILLFOCUS: {
- OnLeave(EventArgs.Empty);
if (CausesValidation) {
CancelEventArgs e;
e = new CancelEventArgs(false);
@@ -4101,14 +4113,12 @@
}
this.has_focus = false;
- this.is_selected = false;
OnLostFocus(EventArgs.Empty);
return;
}
case Msg.WM_SETFOCUS: {
if (!has_focus) {
- OnEnter(EventArgs.Empty);
this.has_focus = true;
OnGotFocus(EventArgs.Empty);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches