Case Study: Visual C Project Settings

For a specific example of configurability, let's take a detailed look at the Visual C++ Project Settings property sheet. This is a good example because it is about as complex as a configuration property sheet can get. And there's also plenty of room for improvement!

Multilevel Configuration

The Project Settings property sheet is a good example of a multilevel configuration user interface. It has three levels of configuration. At the highest level, you select the project configuration, typically Debug, Release, or All Configurations. At the next level, you select the specific items you want to change—typically the entire project, Source Files, Header Files, Resource Files, or any combination of these. The Project Settings property sheet then displays all the property pages that are common for the items you selected. Finally, you can change specific settings in each of the property pages.

click to view at full size.

While there are many different ways of handling multilevel configurations, this particular approach is effective because it is visible. That is, you can readily tell what you are doing by looking at what you have selected on the screen. By contrast, I once used a Brand B compiler that used a completely different technique. It let you determine settings for the project as a whole from the menu bar and settings for specific items from a context menu. While this technique doesn't sound all that bad, the problem is that it took me quite a while to realize that this was the way it worked. (Admittedly, this was a long time ago, before context menus were a standard Windows interface.) The program provided a subtle hint that the settings for an individual item were an override of the project settings, but somehow that didn't register immediately. As a result, I used the context menu to change what I thought were the project settings only to be confused when the changes I thought I made to the project didn't take effect. By putting the project settings and the individual item settings together in a single property sheet, the Visual C++ Project Settings makes this confusion impossible.

TIP
Make multilevel configurations visible. Put related configurations in a single property sheet.

Multi-Item Changes

Of course, the real objective behind the Project Settings property sheet is to be able to change settings, and having the ability to change settings for several items at a time is a valuable feature. When you select multiple items, the property sheet displays the property pages that are common to those items. Within each property page, each control shows the settings that are common as well. Check boxes are checked if all the items are checked, not checked if none of the items are checked, or displayed in a mixed-value appearance if the settings are mixed. The edit boxes display all the settings that are common to the selected items. Similarly, the combo boxes display a setting if all the items have the same setting; otherwise, they are blank.

This arrangement makes it easy to change multiple items at one time. Just select the items you want to change, and change them. A default-with-override scheme is used to make it easy to change settings at the project level. For example, if you set one file to compile at warning level 2 and then set the project to compile at warning level 4, the file retains the warning level 2. Ordinarily, this is what you want, but you will be in for a surprise if you select the entire project, change a setting, and think that you changed all the items in the project. In fact, you changed the default value only, and all the individual items with overrides maintained their overrides. If you want to change all items, you have to explicitly select the project and all the relevant items in the project before you make the change.

Displaying the common settings in an edit box is a powerful feature. If you select multiple source files, you can change a preprocessor definition common to all the files simply by changing the common setting. This technique has an interesting side effect. Since the edit box displays only what is common to the selected items, you can change only those settings that are common to those items. For example, let's say you want to completely clear the preprocessor definitions for a group of files that do not have completely common settings. The only way to do it is by clearing the items individually.

I find these rules interesting, and they allow the Project Settings property sheet to work more or less the way the user expects. The only problem I have is that these rules aren't explained anywhere. The Source File Options box helps somewhat by clearly indicating when a value is an override. However, I think there should be a help context for the entire property sheet to explain how the rules work.

TIP
If you set rules for using an interface, you need to explain them.

Room for Improvement

While the Visual C++ Project Settings property sheet is pretty good, I think room for improvement definitely exists. As mentioned earlier, I think the Project Settings property sheet could benefit by providing commands to save, restore, compare, print, and lock configuration settings. By saving the settings to an easily editable text file, the user could bypass the Project Settings property sheet in situations where it gets in the way, such as when making many changes to a large project. Again, I would like the ability to create a project template so that I don't have to remake all the same settings every time I create a new project. I would also like the ability to easily gather all my settings, including those for my toolbar and window layout, and transfer them to other computers. This capability would save me a lot of time.

The Project Settings property sheet has a Reset button that works on the granularity of a single property page. When you click the Reset button, you get the following confirmation:

click to view at full size.

While this is a nice touch, I would usually prefer to restore the settings used before the property sheet was displayed. True, I can obtain that result by simply canceling the property sheet, but that technique isn't so attractive if I've just spent 15 minutes making a bunch of changes and botched the last one. Consequently, I would prefer a message box that looks like this:

One interesting problem I find with the multilevel settings technique used by the Visual C++ Project Settings property sheet is that the settings' visibility doesn't mean that the user has actually seen them. Has the following ever happened to you? You need to add a library to the link, so you display the Project Settings property sheet and add the library file to the link. You then link, and everything is fine. So far, so good. Now you change to a release build and discover that you added the library to the Debug configuration only. While I completely understand this problem, I always seem to make this mistake. The fact that you can make settings like this without even looking at the selected project configuration doesn't help.

The Project Settings property sheet uses the current project configuration as the default. Ordinarily this is a good thing, but some settings, such as the library files, usually need to be set to the All configuration. I rarely need to add a library to just the Debug or Release configuration. I can think of several solutions to this problem, but they all make the general case much less efficient. The only solution I can think of that doesn't affect the general case is to identify the settings that are typically applied to the All configuration and warn the user when he's made a change without explicitly choosing a project configuration.

The Visual C++ Project Settings property sheet is about as complex as a configuration gets. Despite the shortcomings I've mentioned, I find that it works quite well. In fact, I used it for years without fully understanding exactly how it works. The fact that you can use it and get it to do what you want without really understanding exactly how it works is evidence that the feature is effective.



Developing User Interfaces for Microsoft Windows
Developing User Interfaces for Microsoft Windows
ISBN: 0735605866
EAN: 2147483647
Year: 2005
Pages: 334

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net