Programming with Microsoft Visual C++.NET 6ed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming with Microsoft Visual C++.NET 6ed [Electronic resources] - نسخه متنی

George Shepherd, David Kruglinski

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید








How Wizards Work


Before we create a wizard, let's look at how wizards work. We'll look at the three main parts of a wizard: the original boilerplate code, the user interface, and the code it generates.

The general idea behind a code generator is to create a basic project for you to relieve you from having to type all the boilerplate code. That basically means a bare-bones application or library that works and compiles. However, you want the code to reflect the nature of the project. For example, if you're writing a payroll application, you want the classes in the application to have names like CPayrollDoc, CPayrollView, and CPayrollFrame. It's the wizard's job to substitute the plain vanilla names of the basic application with the names the developer types in.

The wizard is also responsible for adding or leaving out certain parts of code, depending on the developer's selections. For example, if you select the About dialog box from a list of options, the wizard will add the correct code for the dialog box to the finished application.

The wizard presents these choices through a user interface. The heart of the wizard's interface is an HTML control named IVCWizCtrlUI. The Visual Studio .NET wizards use HTML to drive the user interface. When you execute the wizard, the IVCWizCtrlUI interface looks for the list of files representing the user interface and displays those pages within the wizard. The wizard is responsible for managing navigation through each of the pages as well as generating the code when the developer clicks the Finish button.

A wizard can contain any number of pages, each driven by a separate HTML file. The wizard provides navigation functionality through the Next and Back buttons (or any other format you specify). The HTML files that implement the wizard interface contain the SYMBOL tag, which identifies the default for developer-defined options.

The wizard maintains a symbol table during the lifetime of its execution. The symbol table is just a dictionary lookup mechanism for making substitutions. The symbols declared in the HTML file are written into the symbol table when the user clicks Finish. For example, examine the following HTML in a wizard user interface:

   <SYMBOL NAME='SOURCE_FILE' VALUE='MySource.cpp' TYPE=text></SYMBOL>

In the wizard user interface, the text box represents an input box for the user to type into. The text box is identified using the symbol SOURCE_FILE. This is the key the wizard will look for when it makes substitutions for source files. We'll look at how that works in just a minute. Basically, each HTML file used by the wizard is responsible for recording user selections to the symbols table.

Logic within the wizards is usually implemented using JScript. If you need to provide customized behavior from within the wizard, you can use JScript functions to access the Visual C++ Wizard Model. These functions are in the HTML page section headed <SCRIPT LANGUAGE='JSCRIPT'>.





Note

For more information about the Visual C++ Wizard Model and other object models that make up the Visual C++ Extensibility Object Model, refer to the MSDN Library.



/ 319