Method of form in Delphi

Source: Internet
Author: User

Forms are also components. Therefore, forms and components have many common methods, including show, showmodal, and invalidate. The following describes some of the most common methods.

1. bringtofront

This method can applyProgramThe form is placed on the top of all other windows.

2. Close and closequery

After you call closequery to close the form, the close method closes the form.

The closequery function calls the onclosequery event handler. If the Boolean variable value passed to the onclosequery handler is set to false, the form is not closed. If it is set to true, the form is closed normally. In the onclosequery event handler, You can prompt the user to save the file and control the closure of the form.

 
Procedure tform1.formclosequery (Sender: tobject; var canclose: Boolean); begin canclose: = false; {the application cannot be closed} end;

3. Print

The print method prints the content of the Form. Only the client area of the form is printed, and the title, title bar, and border are not printed. Print facilitates the quick screen dump of the form.

4. scrollinview

This method can scroll the form to make the specified components visible on the form.

Delphi Syntax:

Procedure scrollinview (acontrol: tcontrol)

5. setfocus

The setfocus method activates the form and brings it to the top level. If the form has components, the components limited to the activecontrol attribute will accept the input focus.

6. Show and showmodal

These two methods are used to display the form. The show method does not display the form in non-mode, so that other forms can be operated when the form is visible. The showmodal method displays the mode form. The mode form must disappear before the user continues to use the application.

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.