🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2051

Re: Help with scrollbars....

#2051
From: David Lord
Date: Thu, 11 Apr 1991 17:01
45 lines
2747 bytes
In article <1991Apr10.213253.20233@ulowell.ulowell.edu> dpelland@hawk.ulowell.edu (David Pelland) writes:
<
<Could someone please explain to me how I can have a child window
<which is of a size larger than the parent window, has scroll bars,
<and is easily managed?  The windows x and y position within the parent
<is fixed.  I basically want to have the scroll bars modify which piece
<of the subwindow the user is viewing at any point.
<
<------------------------------------
<|                                  |
<|     Status information           |
<|                                  |
<|           -----------------------|    basically, I want to 
<|          |                      ^|    be able to scroll the
<|          |                      ||    graphics area without
<|  list    |                      ||    it being an overlapped 
<|  of      |                      ||    window and without 
<|  items   |     graphics         ||    handling it myself.
<|          |     window           ||
<|          |                      ||
<|          |                      v|
<|          |<--------------------> |
<------------------------------------


Unfortunately you have to handle most of it yourself.

As a fairly new Windows programmer who just worked on this same problem
I can tell you that you should keep in mind: Scroll bars are the work of
the devil and are certain to make your life miserable forever.

Actually this one is a fairly easy problem. First you always have to make sure
your child window stays within your parent window. This means adjusting the
size with MoveWindow whenever the parent gets WM_SIZE. If you don't do this
your scroll bars will be off somewhere where you can't get at them. Don't 
forget to adjust the scroll range (SetScrollRange) at the same time.

Now you just have to catch the various scroll messages and take appropriate
actions, ie. scroll the window, set the button position, and keep track of
the x & y offset amounts so you can adjust for the new position when you
handle a WM_PAINT message.

See, what did I tell you, practically trivial :-).

Dave Lord
Technical Details
Message-ID: <1991Apr11.170114.10545@SanDiego.NCR.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!rex!uflorida!gatech!hubcap!ncrcae!ncr-sd!iss-rb!booboo!davel
References: <1991Apr10.213253.20233@ulowell.ulowell.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!rex!uflorida!gatech!hubcap!ncrcae!ncr-sd!iss-rb!booboo!davel
From: davel@booboo.SanDiego.NCR.COM (David Lord)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Help with scrollbars....
Keywords: Scrollbars
Message-ID: <1991Apr11.170114.10545@SanDiego.NCR.COM>
Date: 11 Apr 91 17:01:14 GMT
References: <1991Apr10.213253.20233@ulowell.ulowell.edu>
Sender: rock1@SanDiego.NCR.COM
Reply-To: davel@booboo.SanDiego.NCR.COM (David Lord)
Organization: NCR Corporation, Rancho Bernardo
Lines: 45