Use the Wizard to create a form and Application

Source: Internet
Author: User
Note

If you are using the"Delphi.7.second. Edition. v7.2"Version, due to simplified optimization, the dialog wizard and Application Wizard wizards are removed. To try this wizard, installFull Delphi7.

Delphi has two wizards to guide users to create applications. The dialog wizard (dialog box wizard) helps users create a dialog box and the Application Wizard (Application Wizard) helps you create applications with basic styles. The following sections describe:

Use Dialog wizard (dialog box wizard)

To be honest, there are not many things to do in the dialog box wizard, because the practical value of the dialog box is created using Form Designer. Dialog Wizard starts from the object library and selects the main menu 【File | new | Other] The menu item displays the object library, switches to the dialogs page, and double-click the "dialog wizard" icon, as shown in:

Double-click to display the dialog wizard dialog box, such:

You can choose to create a single page dialog box or multi-page dialog box. The icon on the left of the dialog box is the shape of the dialog box. If you select the create single page dialog box, click Next to display the next page of dialog wizard, as shown in:

On this page, there are three radio buttons:

  • No buttonsNo buttons in the dialog box
  • Vertical along right edgeAdd a button to the right of the dialog box
  • Horizontal along bottomAdd a button at the bottom of the dialog box

This page is the last page of dialog wizard. After selecting the button style, click the finish button. The Delphi automatic creation dialog box is displayed, for example:

The new dialog box is displayed on Form Designer. It has all the features selected through the wizard, and its borderstyle attribute is bsdialog, as shown in:

After creating the basic dialog box with dialog wizard, you can use Form Designer to add various functions to it.

If you create a multi-page dialog box, the second page of the dialog wizard is as follows:

 

, Select "multipage, using pagecontrol" Multi-page dialog box

The figure shows the multi-line editing box. In the dialog box, enter the name of each page and a page name for each action, for example:

Click "Next" to display the dialog box for selecting the button location. Then, click "finish" to create a dialog box for multiple pages in Delphi, as shown in:

Note

The biggest use of dialog wizard is to create a multi-page dialog box. When creating a single page dialog box, it is easier to select a pre-defined dialog box from the object library to create a dialog box through dialog wizard.

Use Application Wizard (Application Wizard) to create an application

Application Wizard is a useful tool that allows you to quickly create application shells. Use Application Wizard to create an application. Select File | new | Other from the main menu. When the object library appears, click the projects page and double-click the "Application Wizard" icon, for example:

Note

The [file | new | application] menu item in the main menu creates an application based on the current default Project Settings. It does not start Application Wizard.

The following describes how to use Application Wizard step by step.

(1) Page 1: Selecting the menus)

The first window displayed after Application Wizard is started is shown in:

This window is used to select the main menu item of the program. You can selectively Add the file, edit, window, and help menus to the main menu of the application.

Tip

The Window menu is usually left for the MDI application. If you do not have special requirements, do not add a window menu to the menu bar of the SDI application.

 

Note

The menu that application wizard adds to an application is the most common menu for Windows applications. Remember that the application created by Application Wizard is only a basic framework. These basic frameworks must be modified to make them a practical application.

After selecting the menu for the application, click Next to go to the next page.

(2) Page 2: Setting the file dialog Filters)

If the File menu is added to the Application menu, the following window is displayed:

This window is used to set the filters used in the application file open and File Save dialog boxes. Click the Add button to add a new filter. A dialog box is displayed, asking you to enter the description and filter. Enter a filter, text description, and actual file mask (for example, *. BMP) Like setting the filter attribute of the public file dialog box component ). You can use the edit, delete, or down buttons to change, delete, or move a filter.

Note

Only when the menu is selected on the first page of Application Wizard, the second and third pages are displayed. More specifically, the second page is displayed only when the File menu is selected on the first page.

(3) Page 3: setting up the speedbar)

The third page of Application Wizard is used to create the toolbar of the application. This may be the most useful feature of Application Wizard. You can quickly create a toolbar on this page. As shown in, the toolbar has been created in the figure.

The menus list box on the left side of this page lists four menus. You can add buttons for each menu. Choose one of the Four menus. The available commands list box on the right of the menus list box lists the valid buttons of the menu. To add a toolbar button, click the button in the available commands list box and then click the insert button. The selected button is added to the toolbar.

Use the space button to add a separator line to the toolbar. You can add separators to group buttons. As long as the toolbar is not full, you can add a button to it. To delete a button in the toolbar, click the button in the toolbar and click Remove.

Note

If a menu is not added to the application, a button is not displayed for the menu. For example, if the window menu is not added, When you click the window item in the menus list box, the available commands list box is empty.

Tip

Some special applications only have a toolbar without menus. You must create a menu before using Application Wizard to create a toolbar. To solve this problem, you can use Application Wizard to create a menu at will. In the creation toolbar, after the program is generated, you can delete the mainmenu component from the application to delete the menu.

Page 4: Setting the final options)

The fourth and last page of Application Wizard is used to set the program name, store the path of the project, and other options. As shown in:

The first field on this page specifies the application name. It is not the application name that appears in the Project Options dialog box, but the file name That Delphi uses to store the project. You still need to set the application name in the Project Options dialog box. The second field is used to specify the storage directory of the project. If you cannot remember the specific path, click the browser button and select the path from the Select Directory dialog box.

Tip

You can create and select a directory in the Select Directory dialog box. Click the browser button to display the Select Directory dialog box. Enter the path of the directory to be created, and click OK or enter. If the input directory does not exist, Delphi will prompt you to create a new directory.

The lower part of this page provides three additional options. If you create an MDI application, select the "Create MDI Application" check box. The remaining two check boxes are used to create the status bar and whether to allow display of tooltip.

After you have determined all the options for the application, click the next button and Delphi will create the application based on the specified options. Delphi tries to write as much application code as possible, but after all, it is a small amount of basic code. For example, when the File menu is selected, the fileopenclick Handler has been processed into the following format:

Procedure TMainForm.FileOpen(Sender: TObject);begin  if OpenDialog.Execute then  begin    { Add code to open OpenDialog.FileName }  end;end; 

The code for executing the file open dialog box has been written. You only need to write the actual code for processing.

Tip

After creating a project using Application Wizard, you can select 【Project | add to Repository]Save the project as a menu item and save it for later use. This saves you the trouble of using Application Wizard to create a basic application. Before saving the project to the object library, you 'd better add an about dialog box.

The wizard is simple and quick, but many programs still need to be compiled manually. Delphi provides a good start, saving the tedious process of manually creating basic application elements.

Note

In addition to the dialog wizard and Application Wizard wizards, Delphi also provides other wizards. For example, database Form Wizard is used to create a database form, and ActiveX Control wizard helps to create ActiveX controls. These are dedicated wizard. It will be introduced in future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.