Author: jackson
Date: 2006-07-25 16:39:34 -0400 (Tue, 25 Jul 2006)
New Revision: 62969
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
Log:
* UpDownBase.cs: Use an internal class for the textbox
* so that we
can control focus. the updown control should always have focus,
if either the text area or the buttons are clicked.
- Send the key messages to the textbox, since it never actually
has focus
- Activate and decativate the textbox caret.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-07-25 16:20:32 UTC (rev 62968)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-07-25 20:39:34 UTC (rev 62969)
@@ -1,3 +1,22 @@
+2006-07-25 Jackson Harper <[EMAIL PROTECTED]>
+
+ * UpDownBase.cs: Use an internal class for the textbox so that we
+ can control focus. the updown control should always have focus,
+ if either the text area or the buttons are clicked.
+ - Send the key messages to the textbox, since it never actually
+ has focus
+ - Activate and decativate the textbox caret.
+
+2006-07-24 Jackson Harper <[EMAIL PROTECTED]>
+
+ * Control.cs: Use the directed select when selecting a control,
+ this way the container controls override will get called and the
+ whole ActiveControl chain will get triggered. TODO: probably need
+ to make sure this gets done everywhere instead of the old
+ Select(Control).
+ * ContainerControl.cs: Implement the directed Select method to
+ find and activate the correct child control.
+
2006-07-22 Mike Kestner <[EMAIL PROTECTED]>
* Form.cs: use Control.MousePosition for NCLBUTTONDOWN in the menu
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
2006-07-25 16:20:32 UTC (rev 62968)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
2006-07-25 20:39:34 UTC (rev 62969)
@@ -223,11 +223,53 @@
compute_rects();
}
#endregion // Protected Instance Methods
+
+
+ internal override void OnGotFocusInternal (EventArgs e)
+ {
+ owner.Select (true, true);
+ }
+
+ internal override void OnLostFocusInternal (EventArgs e)
+ {
+ owner.Select (true, true);
+ }
}
#endregion // UpDownSpinner Sub-class
+ internal class UpDownTextBox : TextBox {
+
+ private UpDownBase owner;
+
+ public UpDownTextBox (UpDownBase owner)
+ {
+ this.owner = owner;
+
+ SetStyle (ControlStyles.FixedWidth, false);
+ }
+
+ internal void ActivateCaret (bool active)
+ {
+ if (active)
+ document.CaretHasFocus ();
+ else
+ document.CaretLostFocus ();
+ }
+
+
+ internal override void OnGotFocusInternal (EventArgs e)
+ {
+ owner.Select (true, true);
+ }
+
+ internal override void OnLostFocusInternal (EventArgs e)
+ {
+ owner.Select (true, true);
+ }
+ }
+
#region Local Variables
- internal TextBox txtView;
+ internal UpDownTextBox txtView;
private UpDownSpinner spnSpinner;
private bool _InterceptArrowKeys = true;
private LeftRightAlignment _UpDownAlign;
@@ -242,7 +284,7 @@
spnSpinner = new UpDownSpinner(this);
- txtView = new FixedSizeTextBox(false, true);
+ txtView = new UpDownTextBox (this);
txtView.ModifiedChanged += new EventHandler(OnChanged);
txtView.AcceptsReturn = true;
txtView.AutoSize = false;
@@ -260,13 +302,12 @@
Height = PreferredHeight;
base.BackColor = txtView.BackColor;
- GotFocus += new EventHandler (GotFocusHandler);
TabIndexChanged += new EventHandler
(TabIndexChangedHandler);
txtView.MouseWheel += new
MouseEventHandler(txtView_MouseWheel);
txtView.KeyDown += new
KeyEventHandler(OnTextBoxKeyDown);
txtView.KeyPress += new
KeyPressEventHandler(OnTextBoxKeyPress);
- txtView.LostFocus += new
EventHandler(OnTextBoxLostFocus);
+// txtView.LostFocus += new
EventHandler(OnTextBoxLostFocus);
txtView.Resize += new EventHandler(OnTextBoxResize);
txtView.TextChanged += new
EventHandler(OnTextBoxTextChanged);
@@ -307,11 +348,6 @@
}
}
- private void GotFocusHandler (object sender, EventArgs e)
- {
- txtView.Focus ();
- }
-
private void TabIndexChangedHandler (object sender, EventArgs e)
{
txtView.TabIndex = TabIndex;
@@ -320,6 +356,18 @@
internal override void OnPaintInternal (PaintEventArgs e) {
e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor),
ClientRectangle);
}
+
+ internal override void OnGotFocusInternal (EventArgs e)
+ {
+ base.OnGotFocusInternal (e);
+ txtView.ActivateCaret (true);
+ }
+
+ internal override void OnLostFocusInternal (EventArgs e)
+ {
+ base.OnLostFocusInternal (e);
+ txtView.ActivateCaret (false);
+ }
#endregion // Private Methods
#region Public Instance Properties
@@ -418,7 +466,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override bool Focused {
get {
- return txtView.Focused;
+ return base.Focused;
}
}
@@ -657,6 +705,14 @@
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected override void WndProc(ref Message m) {
+
+ switch((Msg) m.Msg) {
+ case Msg.WM_KEYUP:
+ case Msg.WM_KEYDOWN:
+ case Msg.WM_CHAR:
+ XplatUI.SendMessage (txtView.Handle, (Msg)
m.Msg, m.WParam, m.LParam);
+ break;
+ }
base.WndProc (ref m);
}
#endregion // Protected Instance Methods
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches