ComponentOne VSView 8.0
Upgrading From Previous Versions

Visual Basic projects that use VSView7 may be upgraded to VSView8 using the conversion utility provided in the distribution package.

The conversion utility is a Visual Basic program called Convert7to8, and its source code is included should you want to see exactly what it does. It is installed to C:\Program Files\ComponentOne Studio\Utilities by default. Please note that it may be installed elsewhere if you installed the product to another location.

Convert7to8 reads the name of an existing Visual Basic project, parses the names of all forms, then makes all the changes needed to each file. The routine saves the original files with a "bak" extension that is appended to the original file name (e.g., "Form1.frm" becomes "Form1.frm.bak").

Changes from VSView7 to VSView8

VSView8 is highly compatible with VSView7 on a source-code level. Most of the changes made to the library consist of new properties, events, methods, and settings to existing properties. These changes do not affect existing code.

There are a few exceptions, however. Fortunately, these are handled automatically for you by the Convert7to8 utility included with VSView8. The list below describes all the changes that may affect your code and the reasons why they were made:

Packaging Changes

In VSView7, a single OCX file contained the three controls. In VSView8, each control is contained in a separated file (VSPrint8.ocx, VSDraw8.ocx, VSVPort8.ocx. and VSPDF8.ocx). This change was made mainly to facilitate deployment of applications over the Internet. Applications that use only one of the controls no longer need to install the other two.

Property Changes

The MouseScroll, MouseZoom, and MousePage properties have been replaced with the new Navigation property. This change was necessary because the new control supports navigation with the mouse wheel and keyboard, and the new Navigation property covers all navigation modes.

The HTMLFileName, HTMLStyle, and TextHTMLRaw properties have been replaced with the new ExportFile, ExportFormat, and ExportRaw properties. This change was made to support the new RTF export capability of the control.

Method Changes

The DrawPicture method has two new optional parameters, Align and Shade, which give better control over the scaling and placement of the picture within the specified rectangle. Since the new parameters are optional, this change does not affect VB source code, but it may affect MFC-based C++ projects.

The PrintDoc method now allows you to pass a string as the FromPage parameter. When used in this way, the string should contain a page range encoded as comma-separated numbers and hyphen-separated subranges, for example, 1-3, 5, 7, 8-12. This change does not affect any source code.

Event Changes

The MouseZoom, MousePage, and MouseScroll events have been replaced with the new BeforeUserZoom, AfterUserZoom, BeforeUserPage, AfterUserPage, BeforeUserScroll, and AfterUserScroll. This change was made for two reasons. First, the new control supports zooming with the mouse, wheel and keyboard, so the old naming became inadequate. Second, the old events were fired before and after the events, which was confusing.

The NewTableCell event has been replaced with the new BeforeTableCell and AfterTableCell events. This change was made to make the rendering of tables more flexible and efficient. The new events have parameters that allow you to turn off the events, thus increasing speed, and the AfterTableCell event allows you to draw additional elements over the table cell after it has been rendered.

Upgrading Visual Basic projects

Upgrading existing projects from VSView7 to VSView8 is easy. The CONVERT.EXE utility provided will convert almost any VB project in a completely automatic way. The utility is provided in source code format, so you can see exactly what is being done to your projects.

Using CONVERT is simple: just run the utility, pick the project you want to convert, and click OK. The utility will create a backup copy of all files in the project, make all changes needed to the project files, and also warn you of any potential problems.

After running CONVERT, open the converted project in VB and compile it just to make sure the new project is 100% syntactically correct. In a few cases, you may need to make a few additional changes by hand.

Upgrading C++ Projects

Converting C++ projects requires more work, and there is no utility to help you with the process, which is easy but tedious. Here is the sequence of steps we recommend:

  1. Open each dialog that contains VSView7 controls.

  2. Remove each VSView7 control and use the Class Wizard to delete its member variable (for example, m_Printer).

  3. For each control you removed, add a corresponding VSView8 control and use the Class Wizard to create a member variable with the same name as the control you deleted (for example, m_Printer). Also make sure the new control has the same resource ID as the one that was deleted.

  4. Build the project and fix any syntax errors found by the compiler. Most should be because of variable type changes and easy to fix.

  5. You may also want to remove the old control wrapper classes from your project. Go to the Project Window and delete files vsprinter.cpp and vsprinter.h (there should be new ones called vsprinter1.cpp and vsprinter1.h).

Converting controls that are created dynamically (for example, not drawn on a dialog) follows a similar process. You still need the class wrapper files for the new controls, which VC++ creates for you. Then you must change the declaration of the control member variables (for example, m_Printer) to use the class name declared in the new wrappers. From then on, follow steps 4 and 5 described above.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback