Re: [Mono-winforms-list] Support for programatic scrolling via WM_VSCROLL and WM_HSCROLL messages

2008-08-20 Thread Ivan N. Zlatev
Jeff Richardson wrote:
> This patch adds support for certain controls to respond to WM_HSCROLL
> and WM_VSCROLL messages to allow them to be scrolled programatically.
> I've implemented this for every control in which both contains an
> instance of ImplicitVScrollBar and ImplicitHScrollBar and have the
> corresponding .NET type respond to sending the WM_HSCROLL and WM_VSCROLL
> messages, with the exception of MdiClient (I'm unsure exactly how to
> test that).
>
>

* The patch breaks the compilation as you are not adding the ScrollType
file to the list of sources in System.Windows.Forms.dll.sources

* The ScrollType enum is redundant - we already have it as
ScrollBarCommands in XplatUIStructs

Index: System.Windows.Forms/ScrollType.cs
===
--- System.Windows.Forms/ScrollType.cs  (revision 0)
+++ System.Windows.Forms/ScrollType.cs  (revision 0)
@@ -0,0 +1,10 @@
+namespace System.Windows.Forms{
+internal enum ScrollType{
+SB_LINEUP =0,
+SB_LINEDOWN =  1,
+SB_PAGEUP =2,
+SB_PAGEDOWN =  3,
+SB_TOP =   6,
+SB_BOTTOM =7,
+}
+}


Commenting out the SendWMScroll method basically breaks scrolling
completely. I don't know if and how you've tested your patch. Unlike
WinForms on MSNET/Win32 our scrollbars are custom controls and they
don't automagically fire WM_?SCROLL messages somewhere down the native
code pipe, so by commenting out the method we won't ever send/receive
WM_?SCROLL.

--- System.Windows.Forms/ScrollBar.cs   (revision 109230)
+++ System.Windows.Forms/ScrollBar.cs   (working copy)
@@ -668,6 +668,12 @@
}

private void SendWMScroll(ScrollBarCommands cmd) {
+   // Since the WM_?SCROLL messages actually trigger
+   // scrolling a control at the same time as the
+   // control responds to the ScrollBar events,
+   // having the ScrollBar send the WM_?SCROLL event
+   // tends to cause a double scroll.
+   /*
if ((Parent != null) && Parent.IsHandleCreated) {
if (vert) {
XplatUI.SendMessage(Parent.Handle, 
Msg.WM_VSCROLL, (IntPtr)cmd,
implicit_control ? IntPtr.Zero : Handle);
@@ -675,6 +681,7 @@
XplatUI.SendMessage(Parent.Handle, 
Msg.WM_HSCROLL, (IntPtr)cmd,
implicit_control ? IntPtr.Zero : Handle);
}
}
+   */
}


* A minor coding style issue is the lack of space prior to the opening (
in most of the method definition.

The rest of the patch seems alright. It's very unfortunate that we have
to do this for each control though.

Please send a revised patch, thanks.

-- 
Kind Regards,
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Support for programatic scrolling via WM_VSCROLL and WM_HSCROLL messages

2008-08-10 Thread Ivan N. Zlatev
On Sat, Aug 2, 2008 at 6:11 PM, Jeff Richardson
<[EMAIL PROTECTED]> wrote:
> This patch adds support for certain controls to respond to WM_HSCROLL and
> WM_VSCROLL messages to allow them to be scrolled programatically.  I've
> implemented this for every control in which both contains an instance of
> ImplicitVScrollBar and ImplicitHScrollBar and have the corresponding .NET
> type respond to sending the WM_HSCROLL and WM_VSCROLL messages, with the
> exception of MdiClient (I'm unsure exactly how to test that).
> --

Hi,

Sorry for the delay, but it's the vacations period (even for the MWF
team :)) and we've been pretty busy . I have looked at the patch and
there are issues with it. I am on vacation now, so I will post the
details end of this week/early next week.

-- 
Kind Regards,
Ivan N. Zlatev
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-winforms-list] Support for programatic scrolling via WM_VSCROLL and WM_HSCROLL messages

2008-08-04 Thread Jeff Richardson
This patch adds support for certain controls to respond to WM_HSCROLL 
and WM_VSCROLL messages to allow them to be scrolled programatically.  
I've implemented this for every control in which both contains an 
instance of ImplicitVScrollBar and ImplicitHScrollBar and have the 
corresponding .NET type respond to sending the WM_HSCROLL and WM_VSCROLL 
messages, with the exception of MdiClient (I'm unsure exactly how to 
test that).

--

Jeffrey M Richardson, MCP
Index: System.Windows.Forms/Control.cs
===
--- System.Windows.Forms/Control.cs (revision 109230)
+++ System.Windows.Forms/Control.cs (working copy)
@@ -2024,6 +2024,9 @@
if (form != null && form.WindowManager != null)

ThemeEngine.Current.ManagedWindowOnSizeInitializedOrChanged (form);
}
+
+   internal virtual void OnVScroll(ScrollType s) { }
+   internal virtual void OnHScroll(ScrollType s) { }
#endregion  // Private & Internal Methods
 
#region Public Static Properties
@@ -5437,7 +5440,17 @@
WmUpdateUIState (ref m);
return;
}
+   
+   case Msg.WM_VSCROLL: {
+   WmVScroll(ref m);
+   return;
+   }
 
+   case Msg.WM_HSCROLL: {
+   WmHScroll(ref m);
+   return;
+   }
+
default:
DefWndProc(ref m);
return;
@@ -5931,6 +5944,14 @@
}
}
 
+   private void WmVScroll (ref Message m) {
+   OnVScroll((ScrollType)m.WParam);
+   }
+
+   private void WmHScroll (ref Message m) {
+   OnHScroll((ScrollType)m.WParam);
+   }
+
#endregion
 
#region OnXXX methods
Index: System.Windows.Forms/ListBox.cs
===
--- System.Windows.Forms/ListBox.cs (revision 109230)
+++ System.Windows.Forms/ListBox.cs (working copy)
@@ -2179,6 +2179,15 @@
XplatUI.ScrollWindow (Handle, items_area, 0, 
delta, false);
}
 
+   internal override void OnVScroll (ScrollType s) {
+   vscrollbar.ScrollBy(s);
+   }
+
+   internal override void OnHScroll(ScrollType s)
+   {
+   hscrollbar.ScrollBy(s);
+   }
+
#endregion Private Methods
 
 #if NET_2_0
Index: System.Windows.Forms/ListView.cs
===
--- System.Windows.Forms/ListView.cs(revision 109230)
+++ System.Windows.Forms/ListView.cs(working copy)
@@ -3317,6 +3317,16 @@
{
return true;
}
+
+   internal override void OnVScroll(ScrollType s)
+   {
+   v_scroll.ScrollBy(s);
+   }
+
+   internal override void OnHScroll(ScrollType s)
+   {
+   h_scroll.ScrollBy(s);
+   }
#endregion  // Internal Methods Properties
 
#region Protected Methods
Index: System.Windows.Forms/ScrollableControl.cs
===
--- System.Windows.Forms/ScrollableControl.cs   (revision 109230)
+++ System.Windows.Forms/ScrollableControl.cs   (working copy)
@@ -1117,6 +1117,16 @@
Invalidate(false);
ResumeLayout(false);
}
+
+   internal override void OnVScroll(ScrollType s)
+   {
+   vscrollbar.ScrollBy(s);
+   }
+
+   internal override void OnHScroll(ScrollType s)
+   {
+   hscrollbar.ScrollBy(s);
+   }
#endregion  // Internal & Private Methods
 
 #if NET_2_0
Index: System.Windows.Forms/ScrollBar.cs
===
--- System.Windows.Forms/ScrollBar.cs   (revision 109230)
+++ System.Windows.Forms/ScrollBar.cs   (working copy)
@@ -668,6 +668,12 @@
}
 
private void SendWMScroll(ScrollBarCommands cmd) {
+   // Since the WM_?SCROLL messages actually trigger
+   // scrolling a control at the same time as the
+   // control responds to the ScrollBar even