[Mono-winforms-list] Support for programatic scrolling via WM_VSCROLL and WM_HSCROLL messages
Ivan N. Zlatev
contact at i-nz.net
Wed Aug 20 20:05:15 EDT 2008
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."
More information about the Mono-winforms-list
mailing list