Scrollable Region - not entire window

I have some tabs (really menus) across the top of my window used to go to other windows. When I scroll, I don't want the menus to scroll with it. How can I define a window so that the scrolling starts with say line 4 and not line 1?
The ScrollWindowEx function can be used to exclude a portion of the client area from the scrolling operation. This keeps items with fixed positions, such as child windows, from moving within the client area. It automatically invalidates the portion of the client area that is to receive the new information, so the application does not have to compute its own clipping regions.


https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-scrollwindowex

About clipping:

https://docs.microsoft.com/en-us/windows/win32/gdi/clipping

Do you ever try doing a 'net search before you come here? This query was especially easy to find info

https://duckduckgo.com/?q=winapi+scroll+regions+in+client+area&t=ffsb&ia=web.
In terms of over all program architecture, if one is going to have scrollable data within a window/form/dialog containing other child window controls, i.e., menus, buttons, etc., then the scrollable data should exist within it's own child window control - in my opinion. At least - that's the way I'd do it.
Last edited on
Yes. I always first search different functions and forums until I can't find info on solving my problem. ScrollWindowEx hasn't solved my problem yet, so I'll keep looking for why. Obviously, something I'm doing wrong with it, if that is supposed to work. But, thanks for checking in on my thought process.
Look into Clipping Regions.

https://docs.microsoft.com/en-us/windows/win32/gdi/clipping

Remember, even text in a WinAPI GUI app is drawn as if it were graphics.

https://docs.microsoft.com/en-us/windows/win32/gdi/using-clipping
I found the problem, but don't know why exactly.

ScrollWindow and ScrollWindowEx have 2 rect parameters.

prcScroll - const RECT*

Pointer to a RECT structure that specifies the portion of the client area to be scrolled. If this parameter is NULL, the entire client area is scrolled.

prcClip - const RECT*

Pointer to a RECT structure that contains the coordinates of the clipping rectangle. Only device bits within the clipping rectangle are affected. Bits scrolled from the outside of the rectangle to the inside are painted; bits scrolled from the inside of the rectangle to the outside are not painted. This parameter may be NULL.

I was using only the prcScroll as the size of the RECT/window below my tabs. That didn't work. Only when I did use the prcClip as that defined RECT, it worked. Regardless of whether prcScoll was NULL or my defined RECT.

So, I don't know what the prcScroll is actually used for or where you would use each of the 4 combinations.
Topic archived. No new replies allowed.