65.9K
CodeProject is changing. Read more.
Home

Using CResizablePage In a CFormView

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.07/5 (18 votes)

Nov 27, 2000

CPOL
viewsIcon

104205

downloadIcon

2118

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.