Delphi programmer code writing standard guide (6)

zhaozj2021-02-17  49

Seven, component

7.1 User Customizing Components

The name of the component named in the standard component is defined as a class type as the "class type" section definition, and the difference is that they have a 3-character indicator prefix, which can represent companies, individuals, or other entities. For example, the name of the clock member written for the Delphi 4 Developer Guide is defined as:

TDDGCLOCK = Class (Tcomponent)

Note that the three prefix characters are lowercase.

7.2 component unit

The component unit should contain only one primary member, and a major component is a component in the component column. The auxiliary member / object of the main component should be placed in the same unit.

7.3 Using registration unit

The registration process of the component should be removed from the unit itself and put it into a separate unit. This registration unit can be used to register any component, attribute editor, component editor, exemption, etc.

The registration of the component should only be carried out in the design clip, and the registration unit should be included in the design time package and should not be placed in the running moment.

The name of the registration unit recommended is:

Xxxreg.pas

The above three prefix characters "XXX" are used to represent a company, a personal or any other entity. For example, the name of the registration unit in the Delphi 4 Developer Guide should be DDGREG.PAS.

7.4 Component instance naming conventions

All components should take a descriptive name. The components of the default name created by Delphi are not abandoned. A lowercase prefix should be designed when the design component type is designed. The reason why the prefix does not use the suffix is ​​when searching, the name of the search component in the Object Check and the Code Explorer is more easily implemented than the type of search member.

7.5 Prefix of the component

The prefix of the following components can be used to design the standard components in Delphi 4. Please join the prefix of a third party component in this list.

7.6 Standard Page

Prefix member

MM TmainMenu

PM TPopupmenu

Mmi TmainMenuItem

PMI TPopupMenuItem

Prefix member

LBL TLABEL

EDT TEDIT

MEM TMEMO

BTN TBUTTON

CB Tcheckbox

RB Tradiobox

LB TListBox

CB TcomboBox

SCB Tscrollbar

GB TGroupBox

RG TradioGroup

PNL TPANEL

CL TcommandList

7.7 Additional Page

BBTN TbitBTN

SB TspeedButton

Me tmaskedit

SG TSTRINGGRID

DG TDRAWGRID

IMG TIMAGE

SHP TSHAPE

BVL TBevel

SBX Tscrollbox

CLB Tchecklistbox

SPL TSPLITTER

StX TSTATICText

CHT TCHART

7.8 Win32 Page

TBC TTABControl

PGC TPAGECONTROL

Il Timagelist

Re TrichEdit

THR TTRACKBAR

PRB TPROGRESSBAR

UD tupdown

HK THOTKEY

Ani tanimate

DTP TDATETIMEPICKER

TV TTREEVIEW

LV TLISTVIEW

HDR THEADERCONTROL

Prefix member

STB TSTATUSBARTLB TTOOLBAR

CLB TCOOLBAR

7.9 SYSTEM Page

TM TTIMER

PB TPaintBox

MP TMEDIAPLAYER

OLEC TOLECONTAINER

DDCC TDDECLIENTITEM

DDCI TDDeclientItem

DDSC TDDeServerConv

DDSI TDDeServerItem

7.10 Internet Page

CSK TclientSocket

SSK TSERVERSOCKET

WBD TWEBDISPATCHER

PP TPAGEPRODUCER

TP TQueryTableProducer

DSTP TDataSetTableProducer

NMDT TNMDAYTIME

NEC TNMecho

NF TNMFinger

NFTP TNMFTP

NHTTP TNMHTP

NMSG TNMMSG

NMSG TNMMSGServ

NNTP TNMNNTP

NPOP TNMPOP3

Nuup TNMUUUPROCESSOR

SMTP TNMSMTP

NST TNMSTRM

NSTS TNMSTRMSERV

NTM TNMTIME

NUDP TNMUDP

PSK TPOWERSOCK

NGS TNMGENERALRERVER

HTML THTML

URL TNMURL

SML TSIMPLEMAIL

7.11 Data Access Page

Prefix member

DS TDataSource

TBL TTABLE

Qry TQuery

SP TSToredProc

DB TDATABASE

SSN TSession

BM TBATCHMOVE

USQL TUPDATESQL

7.12 Data Controls Page

DBG TDBGRID

DBN TDBNAVIGATOR

DBT TDBText

Dbe Tdbedit

DBM TDBMEMO

DBI TDBIMAGE

DBLB TDBListbox

DBCB TDBCOMBOBOX

DBCH TDBCHECKBOX

DBRG TDBRADIOGROUP

DBLL TDBLOOKUPLISTBOX

DBLC TDBLOOKUPCOMBOX

DBRE TDBRICHEDIT

DBCG TDBCTRLGRID

DBCH TDBCHART

7.13 Decision Cube Page

DCB TDecisioncube

DCQ TDecisionQuery

DCS TDECISISOURCE

DCP TDECISIONPIVOT

DCG TDECISIONGRID

Dcgr TDecisiongraph

7.14 QReport Page

QR TQUickReport

QRSD TQRSUBDetail

QRB TQRBAND

Qrcb TQRCHildband

QRG TQRGROUP

Qrl Tqrlabel

Prefix member

QRT TQRTextqre TQREXPR

QRS TQrsysdata

QRM TQRMEMO

Qrrt tqrrichtext

QrDR TQRDBRICHText

QRSH TQRSHAPE

QRI TQRIMAGE

QrDi Tqrdbmimage

Qrcr TqrcompositerEport

Qrp tqrpreview

Qrch TQRCHART

7.15 Dialogs Page

The dialog assembly is a real form packaged by the component, so they should follow the form of naming conventions. The type has been defined by the name of the component. The name of its instance is the type instance name that Delphi automatically generated removes the digital suffix. For example, as follows:

Type instance name

TopEndialog OpenDialog

TsaveDialog Savedialog

TopenPictureDialog OpenPictureDialog

TsavePictureDialog SavePictureDialog

TFONTDIALOG FONTDIALOGOGOG

TcolorDialog Colordialog

TPrintSetupDialog PrintSetupDialog

TfindDialog FindDialog

TreplaceDialog ReplaceDialog

7.16 Win3.1 Page

DBLL TDBLOOKUPLIST

DBLC TDBLOOKUPCOMBO

TS TTABSET

Ol Toutline

TNB TTABBEDNOTEBOOK

NB TNOTEBOOK

HDR THEADER

FLB TFileListbox

DLB TDIRECTORYLISTBOX

DCB TDRIVECOMBOBOX

FCB TFliterComboBox

7.17 Samples Page

GG TGAUGE

Prefix member

CG Tcolorgrid

SPB TSPINEDIT

SPE TSPINEDIT

DOL TDIRECTORYOUTLINE

Cal Tcalendar

Ibea Tibeventalerter

7.18 ActiveX Page

CFX TCHARTFX

VSP TVSSPELL

F1b TF1BOOK

VTC TVTCHART

GRP TGRAPH

7.19 Midas Page

PRV TPROVIDER

CDS TclientDataSet

QCDS TQueryClientDataSet

DCOM TDCOMCONNECTION

Olee toleEnterpriseConnection

SCK TSOCKETCONNECONNECTION

RMS TREMOTSERVER

Mid TmidasConnection

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

New Post(0)