CodeGuru
Earthweb Search
Login Forums Wireless Jars Gamelan Developer.com
CodeGuru Navigation
RSS Feeds

RSSAll

RSSVC++/C++

RSS.NET/C#

RSSVB

See more EarthWeb Network feeds

follow us on Twitter

Member Sign In
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

Become a Marketplace Partner

jobs.internet.com

internet.commerce
Partners & Affiliates
















Home >> Visual C++ / C++ >> Windows & Dialogs >> Dialog >> Scrolling


A Scrollable Dialog Class (CScrollDialog)
Rating: none

Felix Rivera (view profile)
July 3, 1999


(continued)




Environment: VC6 SP4, NT4 SP3, Win98

MFC's CDialog class is a powerful and flexible class but it has its shortcomings. If we wish to allow the user to resize the dialog and still retain access to all controls within the dialog, then we must either resize/displace the controls within the dialog, or implement any scrolling functionality ourselves.

There are already a good number of articles in CodeGuru which address the first option. This article essentially presents a solution to the second option, the scrollable dialog option. The class presented here is intended to serve as a starting point for those of you who should ever need to implement scrollability in a dialog; it can be used without modification, or it can be tailored to your needs.

To implement a CScrollDialog, simply do the following:

  1. Derive your dialog from CScrollDialog rather than from CDialog.
  2. Add the header definition at the top of your dialog's header file (ie. #include "ScrollDialog.h")
  3. Size your dialog template in the resource editor to its ideal dimensions.

That's it! Upon creation, the ScrollDialog stores its initial dimensions for later reference. Anything smaller than these will enable the corresponding scrollbar(s).

The code was written with MFC version 4.22, and compiles cleanly with Warning level 4. Unicode compatibility is unknown.

Last but not least, I must mention that the window gripper implementation was drawn from code snippets found in the CodeGuru site. Enjoy.

Downloads

Download demo project - 20 KB

Download source - 4 KB

Tools:
Add www.codeguru.com to your favorites
Add www.codeguru.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed







RATE THIS ARTICLE:   Excellent  Very Good  Average  Below Average  Poor  

(You must be signed in to rank an article. Not a member? Click here to register)

Latest Comments:
Can I do Like this..? - Legacy CodeGuru (12/29/2003)
scroll in dialog-based program - Legacy CodeGuru (06/25/2003)
Dialog bigger than screen - answers included - Legacy CodeGuru (06/06/2003)
how can i resize the dialog box...plzz help me... - Legacy CodeGuru (03/31/2003)
CScrollDialog issue with smaller screens - Legacy CodeGuru (01/13/2003)

View All Comments
Add a Comment:
Title:
Comment:
Pre-Formatted: Check this if you want the text to display with the formatting as typed (good for source code)



(You must be signed in to comment on an article. Not a member? Click here to register)

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs