Chapter One Introduction to-delphi (v.) (1)

Source: Internet
Author: User

1.4.3.1 Call Standard dialog box

You can see that the events page of the remaining standard dialogs is blank except for the Font,find,replace dialog box. Because they are not the same as dialog boxes, they are not responsive to standard mouse-keyboard actions and can only be invoked in programs. In the demo program in the first section of this chapter, we have an understanding of using the Color dialog box, add the Execute method of the dialog box to the appropriate place in the program, and execute the standard dialog box.

When preparing an application, you can design the main menu first. In the event handling of a menu item that needs to use the standard dialog box, invoke the standard dialog, execute, and so on to meet the design requirements, that is, the Response menu command Pop-up Standard dialog box.

1.4.3.2 OpenDialog and Savedialog parts

OpenDialog (open file) and Savedialog (Save dialog box) Part processing files are opened and stored, and they have exactly the same property fields. The Defaultext property represents the default extension. When the user does not have a suffix for the input file, the user file can be automatically extended. The FileName property specifies the default filename that appears in the FileName body box. The Filter property provides a file filter. Fileeditstyle determines whether to use edit or Combo-box when you enter a file name, and when set to Fscombobox, the history list Historylist attribute is allowed, which can save a lot of time when the application needs to select files frequently. The Historylist property holds the file name that is displayed in the File name Drop-down box, and uses the ellipsis button of [TStrings] to edit the history list. You can also programmatically implement the Historylist property to the file name History list that was previously opened with OpenDialog. The following program segments can implement automatic history file name loading:

If Opendialog1.execute Then

OpenDialog1.HistoryList.Insert (0,opendialog1.filename);

1.4.3.3 ColorDialog and FontDialog

The Color dialog box ColorDialog We have used in the previous routines, and its more detailed features such as options, please consult the online Help.

Font dialog box font can help users get fonts in a variety of ways. With the OnApply event, you can include a apply button in the Font dialog box, press it, the font set in the dialog box is immediately applied to the specified object, and the dialog box is still open, making it easier to observe the results of the modification.

The following routine places a button Button1 in the form, calling the font dialog to change the font displayed by the Caption property on the button:

Procedure Tform1.button1click (Sender:tobject);

Begin

Fontdialog1.execute;

End

Procedure tform1.fontdlgapply (Sender:tobject);

Begin

Button1.font:= Fontdialog1.font;

End

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.