Mousweel in containerControl

I like to use the mouse wheel in a container control to scroll up and down, using the same code as for the horizontal scrollbar.
using the scrollbar it stops at the top but scroll down until no more data are displayed.

DeCanvas.Scroll ( 0, li_delta, 0, 0, DeCanvas.Width, DeCanvas.Height )

How can I control the top and bottom boundaries using the mouse wheel ? it should stop at the top and bottom of data displayed.
the container control contains labels and text fields which can vary in numbers.
thanks

Not at my Desk right now, but as a quick workaround: While you have a Horiz.Scrollbar in your Window, why not control the Horiz.Scrollbar using the MouseWheel? :wink:

yes and how can I do that ?

You can count them and multiply their height, for example. Then, taking the Window/Container’s Height into account, you can adjust the Value of the Scrollbar accordingly.

thanks Sascha, I will try and see how it works.

1 Like

I would really like to help more, but unfortunately there is too much information missing.
If it doesn’t work, maybe you can provide an example project?

I usually put all the controls in a container that is high enough to fit all the controls. Then I put this container into another container that has the desired height in the window.
Now I scroll up until the inner container has a top value of 0 and down until the inner container has a top value of innerContainer.height - outerContainer.height.

If you want this to happen without the two containers, you can take the top and bottom controls and use them to calculate these values.

that sounds good Marius, I will try that,
thanks