VCL Component Method

Source: Internet
Author: User
Method (methods)

The methods in VCL are functions and procedures. Calling these functions and procedures allows the component to complete certain actions. For example, all visualization components have a method called show, which is used to display components. Another method is hide, which is used to hide components. For example:

MyWindow.Show;{ do something ...}MyWindow.Hide;

The VCL method can be declared as public, protected, and private. The public method can be accessed by component users. In this example, both the hide and show methods are public. The protected method cannot be used by the component user, but it can be used to access the derived class of the component. Of course, the private method can only be accessed by the class itself.

Some methods have parameters and return values, while others do not. This fully depends on how component writers compile this method. For example, the gettextbuf method can be used to retrieve the text of the tedit component. This method can be used to retrieve the text from the tedit component. The specific code is as follows:

var  Buff: array[0..255] of Char;  NumChars: Integer;begin  NumChars := Edit1.GetTextBuf(Buff, SizeOf(Buff));end;

The gettextbuf method shown above has two parameters and returns an integer. When this method is called, the content in the tedit component is placed in the buff variable, the returned value is the number of characters retrieved from the tedit component.

Method rules
  • Methods can be public, protected, and private;
  • Key operators of calling methods;
  • The method can contain parameters and return values;
  • Some methods do not include parameters and do not return values;
  • Only public methods can be used by users who have components.

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.