MouseDown, MouseMove & MouseUp Events doesn't work with HScrollBar

G

Guest

I'm using .NET CF 1.0 SP3
I got the ValueChanged Event for an HScrollBar to work, but it was limited
to value changes occurring whenever a click on the scrollbar or clicks on the
scrollbar arrow buttons, but when I try scrolling the srollbox it returns to
the left most end after I release it.

Since the Scroll Event is not supported in .NET CF, i tried using the
MouseDown, MouseMove & MouseUp Events but it doesn't work with HScrollBar,
VScrollBar & Button Control Classes, but those classes are supported in the
..NET Compact Framework. Have anybody encountered the same problem?
 
D

Daniel Moth

I cannot replicate your problem here. As an aside, not sure why you thought
the mouse events are supported on the scrollbar...

Just to make sure you don't have other code that interferes with this,
create a brand new project, add a hscrollbar to the form and hook into the
ValueChanged event. Place a single line of code in there:
this.Text = hScrollBar1.Value.ToString(); //c#
Me.Text = hScrollBar1.Value.ToString() ' vb

Run. You should see the form's caption changing every time you scroll (no
matter via what method) and there is no "returns to left most" effects.

Let me know how you got on...

Cheers
Daniel
 
G

Guest

I've compiled it for PPC Arm, May I know what device did you try it on?
Nobody else mentioned that they had a problem with the scrollbox of the
HScrollBox in any of the forums. So it might just be Isolated on my device.
I didn't just think that the mouse events are supported on the scrollbar,
but rather I'm sure that they are supported, because it's in both the .NET
Framework SDK and the .NET Compact Framework Help file that the mouse events
MouseDown, MouseMove and the MouseUp are supported in the .NET Compact
Framework. Those mouse events were inherited from System.Windows.Forms.Control
control class. It is my belief (and Jonathan had also mentioned it on his
thread) that .NET CF may have a bug and that the said mouse events and even
the Click system event are not being triggered on the HScrollBar control.
The reason why i'm resorting to using the said mouse events is to create an
alternate Scroll event, The reason why I want to create an alternate scroll
event is because the Scroll event is not supported in .NET CF. The reason why
I want to handle the Scroll event is because when I scroll the scrollbox of
the HScrollBar and release it, it always returns to the left most end and the
HScrollBar.Value always returns to the HScrollBar.Minimum. Is there a way to
capture the mouse event before it gets sent down to the control that is
occupying that area.
Thanks for the suggestion, but I've already tried compiling it bare, with
only the HScrollBar control and the minimum required code just to check the
HScrollBar.Value and to wire a simple mouse event to that control, and it
still wouldn't work, but if I try both the bare code and the code that I'm
using for my project and compiled it for desktop PC, everything works. If you
have any other suggestions, I'd be more than happy to try it out. If not, as
a final solution I might create an alternate HScrollBar deriving from either
the ScrollBar base control class or the Control control class itself. I
think, when they created the .NET CF version and derived the ScrollBar base
control class, from the Control control class, they might have overriden
those event handlers and forgot to call its base event handler, which might
explain why even if we wire event handlers to those events it gets blocked by
the overriden event handlers which in turn fails to call its base event
handler, hence no other event handlers are processed.
 
D

Daniel Moth

Well, given that we are talking about NETCF, you are not compiling for arm
at all. I guess what you *meant* to say is that you are trying it on an arm
device. To answer your question, it works fine for me on a WinCE 4.2 (arm)
device and in both PPC and WinCE emulators (x86). Have you tried it on the
default ppc2002 emulator?

As for the mouse events, I cannot find any documentation that explicitly
states the event is supported by the scrollbar control. Where did you read
that (url)? The point is that unless explicitly stated, you should not
assume it is there. Even when it is stated, the documentation has had things
wrong in the past. To be honest, I didn't even try the mouse event. I looked
in the properties window of the control (c#) and didn't see it there
(usually a big clue).

If you have more input/data to offer so we can look at your issue further,
please do.

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top