Jump to content

Scrolling an unfocused control


leuce
 Share

Recommended Posts

G'day everyone

Can anyone please recommend a strategy for scrolling a control (of an active windows) that doesn't have the focus?

For example, I'm now working on my desktop computer, and as I'm typing in this forum, I can scroll the web page itself even if my focus is on this edit box where I'm typing this message, by simply hovering the mouse cursor over the web page (not on the edit box) and using the mouse's scroll button. If I hover the mouse cursor over the edit box, and use the scroll button, the edit box scrolls (not the web page itself). The reverse is also true... when the focus is not in the edit box, but the edit box does have a scroll bar, then the mouse's scroll button will cause the edit box to scroll if the mouse cursor is over the edit box.

The above example is how I want it to be.

However, on the laptop, the mouse pad's scroll zone scrolls only the active control (even if the mouse cursor isn't over it... which is both weird and annoying). For example, if I've got the AutoIt help file open, with the index to the left, and the index has the focus, using the scroll zone will scroll the index even if my mouse cursor is over the help page itself.

Another reason why this is annoying, is that sometimes clicking a control also causes the mouse to select something in that control. I want to be able to scroll the control without having to click it first (yes, I can use Tab and Shift-Tab... when I'm on the keyboard, that's what I do).

So my draft strategy is as follows:

1. Detect when scroll zone is being used.

2. Get control with focus (put it in a variable for later use)

3. Get mouse position

4. Get control under mouse

5. Switch focus to control under mouse

6. Do nothing until a mouse-up is detected (ie, when the scoll zone ceases to be used), or until the mouse is clicked.

7. When use stops scrolling, switch focus back to original control (in point 2).

My two problems (questions) are: (a) how to detect when the scroll zone (which is basically the scroll button, I assume) starts to be used, and (:) how to determine which control is under the mouse cursor.

I'm willing to assume that the user has stopped using the scroll zone when no scrolling event has taken place in the past half a second.

Any ideas for me?

Thanks!

Samuel

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...