Properties, Methods and Events

zhaozj2021-02-16  106

This is a paragraph in Delphi7 Developer's Guide tells Properties.

Methods, Events, feel good, special collection

Properties, Methods, And Events

Both the vcl and clox form hierarchies of classes That Are Tied to the IDE, WHERE you

Can Develop Applications Quickly. The Classes in Both Component Libraries Are Based

ON Properties, Methods, And Events. Each Class Includes Data Members (Properties),

Functions That Operate on the data (Methods), And A Way To Interact with users of the

Class (events). The Component Library is Written in The Component Library IS Written

Delphi

Language, Although THE

VCL is based on the Windows api and clox is based on the qt widget library.

PROPERTIES

Properties Are Characteristics of An Object That Influnce Either The Visible Behavior OR OR

The Operations of the Object. for Example, The Visible Property Determines WHether AN

Object Can Be Seen in An Application Interface. Well-Designed Properties Make Your

Components Easier for Others To Use and Easier for you to maintain.

Here Are Some of The Useful Features of Properties:

Unlike Methods, Which Are ONLY AVAILABLE AT Runtime, You Can See and Change

Some Properties At Design Time and get Immediate Feedback As The Components

Change in the ident.

? You Can Access Some Properties in The Object Inspector, Where You Can Modify THE

Values ​​of Your Object Visually. Setting Properties At Design Time Is Easier Than

Writing code and makes your code easier to maintain.

Because the data is encapsulated, it is protected and private to the actual object.

? The calls to get and set the value of profmenties can be belethods, So Special

Processing Can Be Done That INVISIBLE TOTEER OF THE OBJECT. for Example, Data

COULD RESIDE IN A TABLE, But Could Appear as a Normal Data Member to Theprogrammer.

? You can IMPLEMENT Logic That Triggers Events or Modifies Other Data Database

Access of a property. for example, changing the value of one property allowing the value of One Property May Require

You to modify another. You can change the method.

? Properties Can Be Virtual.

? A property is not restricted to a single object. Changing One Property On One Object

CAN Affect Several Objects. for Example, Setting The Checked Property On A Radio

Button Affects All of the Radio Buttons in the group.

Methods

A Method Is a Procedure That Is Always Associated with a class. Methods Define the

BEHAVIOR OF An Object. Class Methods Can Access All The Public, Protected, And

PrivateProperties and Fields of the Class and Are Commonly ReferRed To As Member

Functions. See "Controlling Access" on page 2-6 of The Component Writer's Guide.

Although Most Methods Belong to An Instance of a Class, Some Methods Belong

INSTEAD to the class type. These is caled class methods.

Events

An Event Is An Action Or Occurrence Detected by a Program. MOST Modern Applications

Are Said to Be Event-Driven, Because They Are Designed To Respond To Events. in A

Program, The Programmer Has No Way of Predicting The Exact Sequence of Actions A

User Will Perform. for Example, The User May Choose A Menu Item, Click A Button, OR

Mark Some text. You can write code to handle the events in which you are interested,

Rather Than Writing Code That Always Executes in The Same Restricted Order.

Regardless of how an event is triggered, VCL Objects Look to see if you have writewritten

Any Code to Handle That Event. if You Have, That Code Is Executed; Otherwise, The

Default Event Handling Behavior Takes Place.The Kinds of Events That Can Occur Can Be Divided Into Two Main Categories:

User Events

?Tem Events

INTERNAL EVENTS

User Events

User Events Are Actions That The User Initiates. Examples of User Events Are Onclick

(The User Clicked The Mouse), OnkeyPress (The User Pressed A Key On The Keyboard),

And OndblClick (The User Double-Clicked A Mouse Button).

System Events

System Events Are Events That The Operating System Fires for you. For example, the

Ontimer Event (Which The Timer Component Issues WHENEVER A PREDEfined Interval

Has Elapsed, The onpaint Event (a Component Or WINDOW Needs to Be RedRawn), And

SO ON. Usually, System Events Are Not Directly Initiated by a User Action.

INTERNAL EVENTS

INTERNAL EVENTS Are Events That Are Generated by the Objects in Your Application. AN

EXAMPLE OF An Internal Event Is The Onpost Event this a dataset generates for Your

Application Tells it to post the current record.

转载请注明原文地址:https://www.9cbs.com/read-10744.html

New Post(0)