Click here to Skip to main content
15,881,173 members
Articles / Desktop Programming / MFC
Article

Using CResizablePage In a CFormView

Rate me:
Please Sign up or sign in to vote.
3.07/5 (18 votes)
16 Apr 2001CPOL 102.9K   2.1K   27   7
Technique for utilizing a CResizablePage in a CFormView-derived class

Introduction - A Little Background

My first exposure to Paolo Messina's code for creating a resizable dialog box involved a CPopertySheet embedded in a dialog box which (of course) contained one or more (dynamically added) property pages. The app itself was already well along in the development cycle, but it still wasn't difficult at all to add the support from CResizable*.* that I needed.

Due to the nature of the property sheet, I didn't need the CResizableSheet code, but I did make use of the other two components (CResizableDialog and CResizablePage).

The Task At Hand

Over the last couple of months, my boss has been developing an application with a splitter view containing a CTreeView, a couple of CListViews, and a CFormView containing a tab control with several tabs that each contain a list control.

As you all know, when a view is resized to be smaller than the data/object it contains, the pane automatically displays scroll bars so that you can scroll the desired portion into view. The formview pane had the nasty habit of scrolling the entire pane when such an event occurs, and this has the side affect (in our case) of scrolling the tab titles out of the visible pane.

To remedy this situation, I used the embedded property sheet technique that I had used in my other application, and instead of using a tab control, I used individual CResizablePage objects to represent the tabs.

When using a property sheet, you have the benefit of a self-induced border around the tab control. While this is handy on a dialog box, it's a royal pain with a CWnd on a formview, especially our formview. The fix was to offset the page enough to where the list control on the tabs filled the entire pane, thus emulating the pane scroll bars.

I guess the long and short of it is that the formview looks like a tabbed list view, and the tabs don't scroll off the pane when the scroll bars (if any) are manipulated.

I've included a demo (the same one I gave my boss) of the technique I used.

I don't remember where I got the code for the embedded property sheet, but it sure has come in handy in a number of instances.

Lastly, many tanks to Paolo for the CResizable*.* classes. They've been the most useful set of classes I've used in many, many years.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.

Comments and Discussions

 
QuestionDemo Broken? Pin
Stephen Woods1-Apr-02 19:13
Stephen Woods1-Apr-02 19:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.