1. Trang chủ
  2. » Công Nghệ Thông Tin

delphi - visual component libary referecne - delphi for windows

1,1K 9K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.072
Dung lượng 4,94 MB

Nội dung

Introduction 1 Delphi for Windows Copyright Agreement Introduction This manual is a reference for the Delphi Visual Component Library (VCL) and the Delphi run-time library. Use it when you want to look up the details of a particular VCL object, component, variable, property, method, event, routine, or type and find out how to use it. Note See online Help for documentation of the Object Pascal Language Definition and Reference. Manual conventions The printed manuals for Delphi use the typefaces and symbols described in Table Intro.1 to indicate special text. Contacting Borland The Borland Assist program offers a range of technical support plans to fit the different needs of individuals, consultants, large corporations, and developers. To receive help with this product send in the registration card and select the Borland Assist plan that best suits your needs. North American customers can register by phone 24 hours a day by calling 1-800-845-0147. For additional details on these and other Borland services, see the Borland Assist Support and Services Guide included with this product. Table Intro.1 Typefaces and symbols in these manuals Typeface or symbol Meaning Monospace type Monospaced text represents text as it appears onscreen or in Object Pascal code. It also represents anything you must type. Boldface Boldfaced words in text or code listings represent Object Pascal reserved words or compiler directives. Italics Italicized words in text represent Object Pascal identifiers, such as variable or type names. Italics are also used to emphasize certain words, such as new terms. Keycaps This typeface indicates a key on your keyboard. For example, “Press Esc to exit a menu.” This symbol indicates a key, or important property, method, or event. This symbol indicates a run-time only property, method or event. Visual Component Library Reference 2 Delphi Visual Component Library Delphi Visual Component Library The VCL is made up of objects, most of which are also components. Using the objects and components of VCL, you are unlimited in the range of Windows programs you can develop rapidly. Delphi itself was built using VCL. Delphi objects contain both code and data. The data is stored in the fields and properties of the objects, and the code is made up of methods that act upon the field and property values. All objects descend from the ancestor object TObject. Components are visual objects that you can manipulate at design time. All components descend from the TComponent object. To program with a component, this is the model you will use most frequently: 1 Select a component from Delphi’s Component palette and add it to a form. 2 Set property values of the component using the Object Inspector. 3 Respond to events that might occur to the component at run time. To respond to an event, you write code within an event handler. Your code modifies property values and calls methods. For detailed information on how to perform these three steps, see the Delphi User’s Guide. You can create your own objects and components by deriving them from the existing Delphi objects and components. For information about writing your own components, see the Delphi Component Writer’s Guide. Visual Component Library objects Objects are the fundamental elements of the VCL. In fact, all components and controls are based on objects. Objects differ from controls in that you can access them only at run time. Unlike most components, objects do not appear on the Component palette. Instead, a default instance variable is declared in the unit of the object or you have to declare one yourself. For example, the Clipboard variable is declared in the Clipbrd unit. To use a TClipboard object, add the Clipbrd unit to the uses clause of the unit, then refer to the Clipboard variable. However, to use a TBitmap object, add the Graphics unit to the uses clause of the unit, then execute the following code at run time to declare an instance variable: var Bitmap1: TBitmap; begin Bitmap1 := TBitmap.Create; end; Note The memory allocated for objects that you explicitly declare should be released when you are finished with the object. For example, call the Free method of the bitmap: Bitmap1.Free; Introduction 3 The properties, methods, and events that all objects have in common are inherited from an abstract object type called TObject. You need to understand the internal details of TObject only if you are creating a new object based on TObject. The following is a list of all objects in the VCL that directly descend from TObject.: Note In addition to these objects, all VCL components also descend from TObject, although not directly. The TObject object introduces the following methods that all objects and components inherit: Visual Component Library components Components are the building blocks of Delphi applications. You build an application by adding components to forms and using the properties, methods, and events of the components. The properties, methods, and events that all components have in common are inherited from an abstract component type called TComponent. You need to understand the internal details of TComponent only if you are writing a component based on TComponent. The following is a list of all components in the VCL: Table Intro.2 VCL objects TBitmap TGraphic TOutlineNode TBlobStream TGraphicsObject TParam TBrush TIcon TParams TCanvas TIndexDef TPen TClipboard TIndexDefs TPicture TControlScrollBar TIniFile TPrinter TFieldDef TList TStringList TFieldDefs TMetafile TStrings TFont TOLEDropNotify Table Intro.3 Object methods ClassName ClassType Destroy ClassParent Create Free Table Intro.4 VCL components TApplication TDDEClientItem TOutline TBatchMove TDDEServerConv TPaintBox TBCDField TDDEServerItem TPanel TBevel TDirectoryListBox TPopupMenu TBitBtn TDrawGrid TPrintDialog TBlobField TDriveComboBox TPrinterSetupDialog TBooleanField TEdit TQuery 4 Delphi Visual Component Library Most components are available from the Component palette. You will not find the following components on the Component palette, however: The TComponent component introduces the following properties that all components inherit: TButton TField TRadioButton TBytesField TFileListBox TRadioGroup TCheckBox TFilterComboBox TReplaceDialog TColorDialog TFindDialog TReport TComboBox TFloatField TSaveDialog TCurrencyField TFontDialog TScreen TDatabase TForm TScrollBar TDataSource TGraphicField TScrollBox TDateField TGroupBox TSession TDateTimeField THeader TShape TDBCheckBox TImage TSmallIntField TDBComboBox TIntegerField TSpeedButton TDBEdit TLabel TStoredProc TDBGrid TListBox TStringField TDBImage TMainMenu TStringGrid TDBListBox TMaskEdit TTabbedNotebook TDBLookupCombo TMediaPlayer TTable TDBLookupList TMemo TTabSet TDBMemo TMemoField TTimeField TDBNavigator TMenuItem TTimer TDBRadioGroup TNotebook TVarBytesField TDBText TOLEContainer TWordField TDDEClientConv TOpenDialog Table Intro.5 Components not on the Component palette TApplication TDateTimeField TScreen TBCDField TField TSession TBlobField TFloatField TSmallIntField TBooleanField TGraphicField TStringField TBytesField TIntegerField TTimeField TCurrencyField TMemoField TVarBytesField TDateField TMenuItem TWordField Table Intro.6 Component properties ComponentCount Components Owner ComponentIndex Name Tag Table Intro.4 VCL components (continued) Introduction 5 In addition to the methods components inherit from the TObject object, the TComponent component introduces the following: Visual Component Library controls Controls are visual components; that is, they are components you can see when your application is running. All controls have properties in common that specify the visual attributes of controls, such as Left, Top, Height, Width, Cursor, and Hint. The properties, methods, and events that all controls have in common are inherited from an abstract component type called TControl. You need to understand the internal details of TControl only if you are writing a component based on TControl. The following is a list of all controls in the VCL. In addition to the properties controls inherit from the TComponent component, the TControl component introduces the following: Table Intro.7 Component methods FindComponent InsertComponent RemoveComponent Table Intro.8 VCL controls TBevel TDBText TNotebook TBitBtn TDirectoryListBox TOLEContainer TButton TDrawGrid TOutline TCheckBox TDriveComboBox TPaintBox TComboBox TEdit TPanel TDBCheckBox TFileListBox TRadioButton TDBComboBox TFilterComboBox TRadioGroup TDBEdit TForm TScrollBar TDBGrid TGroupBox TScrollBox TDBImage THeader TShape TDBListBox TImage TSpeedButton TDBLookupCombo TLabel TStringGrid TDBLookupList TListBox TTabbedNotebook TDBMemo TMaskEdit TTabSet TDBNavigator TMediaPlayer TDBRadioGroup TMemo Table Intro.9 Control properties Align Cursor ShowHint BoundsRect Enabled Top ClientHeight Height Visible ClientOrigin Hint Width ClientRect Left ClientWidth Parent 6 Delphi Visual Component Library In addition to the methods controls inherit from the TComponent component, the TControl component introduces the following methods: Visual Component Library windowed controls Windowed controls are controls that: • Can receive focus while your application is running • Can contain other controls • Have a window handle All windowed controls have properties in common that specify their focus attributes, such as HelpContext, TabStop, and TabOrder. Windowed controls also provide the OnEnter and OnExit events. The properties, methods, and events that all windowed controls have in common are inherited from an abstract component type called TWinControl. You need to understand the internal details of TWinControl only if you are writing a component based on TWinControl. The following is a list of all windowed controls in the VCL: Table Intro.10 Control methods BeginDrag GetTextBuf Repaint BringToFront GetTextLen ScreenToClient ClientToScreen Hide SetBounds ControlAtPos Invalidate SetTextBuf Dragging Refresh Show EndDrag SendToBack Update Table Intro.11 VCL windowed controls TBitBtn TDBNavigator TMediaPlayer TButton TDBRadioGroup TMemo TCheckBox TDirectoryListBox TNotebook TComboBox TDrawGrid TOLEContainer TDBCheckBox TDriveComboBox TOutline TDBComboBox TEdit TPanel TDBEdit TFileListBox TRadioButton TDBGrid TFilterComboBox TRadioGroup TDBImage TForm TScrollBar TDBListBox TGroupBox TScrollBox TDBLookupCombo THeader TStringGrid TDBLookupList TListBox TTabbedNotebook TDBMemo TMaskEdit TTabSet Introduction 7 In addition to the properties windowed controls inherit from the TControl component, the TWinControl component introduces the following properties: In addition to the methods windowed controls inherit from the TControl component, the TWinControl component introduces the following methods: The TWinControl component introduces the following events: Visual Component Library nonwindowed controls Nonwindowed controls are controls that: • Cannot receive focus while your application is running • Cannot contain other controls • Do not have a window handle The properties, methods, and events that all windowed controls have in common are inherited from an abstract component type called TGraphicControl. You need to understand the internal details of TGraphicControl only if you are writing a component based on TGraphicControl. The following is a list of all nonwindowed controls in the VCL: Visual Component Library procedures and functions These procedures and functions are part of the VCL, but they aren’t methods of any components or objects. They are categorized here by how they are used. Table Intro.12 Windowed control properties Brush Handle TabOrder Controls HelpContext TabStop ControlCount Showing Table Intro.13 Windowed control methods CanFocus Focused RemoveControl ClientOrigin HandleAllocated ScaleBy Create HandleNeeded ScrollBy Destroy InsertControl SetFocus Table Intro.14 Windowed control events OnEnter OnExit Table Intro.15 VCL nonwindowed controls TBevel TLabel TSpeedButton TDBText TPaintBox TImage TShape 8 Delphi Visual Component Library The following routines are used to display messages in dialog boxes: The following routines are used to define menu command short cuts. The following routines are used to determine the parent form of components: The following routines are used to create graphical points and rectangles: The following routines are used to control Object Linking and Embedding (OLE) container applications: Library reference The alphabetical reference following the sample entry in the next section contains a detailed description of the Delphi VCL objects, components, variables, properties, methods, events, routines, and types you use to develop Windows applications. The reference also contains the procedures, functions, types, variables, and constants that make up the Delphi run-time library and are declared in the System and SysUtils units. These procedures and functions are useful routines that exist outside of the objects of VCL. They are presented here so that you only need to search one reference source for the information you need about programming Delphi applications. Each alphabetically listed entry contains the declaration format and a description of the entry. If the entry is an object, component, routine, or type, the unit that contains the entry is listed at the beginning of the entry. (The unit that corresponds to a variable, property, method, or event is the unit that contains the object or component to which the entry belongs.) If the entry applies to specific objects or components, they are listed. The Table Intro.16 Message dialog box routines InputBox MessageDlg InputQuery MessageDlgPos Table Intro.17 Menu shortcut routines ShortCut ShortCutToText ShortCutToKey TextToShortCut Table Intro.18 Parent form routines GetParentForm ValidParentForm Table Intro.19 Point and rectangle routines Bounds Point Rect Table Intro.20 OLE routines BOLEMediumCalc LinksDlgEnabled ReleaseOLEInitInfo ClearFormOLEDropFormats PasteSpecialDlg SetFormOLEDropFormats InsertOLEObjectDlg PasteSpecialEnabled LinksDlg RegisterFormAsOLEDropTarget Introduction 9 cross-referenced entries and examples provide additional information about how to use the specified entry. The following sample illustrates this format. Sample entry Unit it occupies (if applicable) Applies to Listing of the objects and components the entry applies to, if any. Declaration { The declaration of the entry from the unit it occupies } A description containing specific information about the entry. Note Any special notes that apply to the entry Example A description of the example code that follows. { Example code which illustrates the use of the entry } See also Related entries that are also listed in the VCL Reference. 10 Delphi Visual Component Library [...]... active MDI child form turns blue procedure TForm1.Button1Click(Sender: TObject); var BlueForm: TForm; begin BlueForm := Form1.ActiveMDIChild; BlueForm.Color := clBlue; end; See also ActiveForm property, FormStyle property, MDIChildCount property, MDIChildren property 16 Delphi Visual Component Library Reference ActivePage property ActivePage property Applies to TNotebook, TTabbedNotebook components Declaration... ActiveForm property, OnActiveControlChange event, OnEnter event, OnExit event ActiveForm property Applies to TScreen component Declaration property ActiveForm: TForm; Delphi Visual Component Library Reference 15 A ActiveMDIChild property Run-time and read only The ActiveForm property indicates which form currently has focus, or will have focus when the application becomes active again after another Windows. .. alTop The component remains where you place it in the form This is the default value The component moves to the top of the form and resizes to fill the width of the form The height of the component is not affected The component moves to the bottom of the form and resizes to fill the width of the form The height of the component is not affected The component moves to the left side of the form and resizes... the form The width of the component is not affected The component moves to the right side of the form and resizes to fill the height of the form The width of the component is not affected The component resizes to fill the client area of a form If a component already occupies part of the client area, the component resizes to fit within the remaining client area alBottom alLeft alRight alClient If the form... the current form procedure TForm1.Button1Click(Sender: TObject); begin Screen.ActiveForm := clBlue; end; See also ActiveControl property, ActiveMDIChild property, OnActivate event, OnActiveFormChange event, Screen variable ActiveMDIChild property Applies to TForm component Declaration property ActiveMDIChild: TForm; Run-time and read only The value of the ActiveMDIChild property is the form that currently... the absolute value of the argument X is an integer-type or real-type expression Example var r: Real; i: Integer; begin r := Abs (-2 .3); { 2.3 } i := Abs (-1 57); { 157 } end; Abstract procedure System Declaration procedure Abstract; Delphi Visual Component Library Reference 13 A Active property A call to this procedure terminates the program with a run-time error When implementing an abstract object type,... remaining client area alBottom alLeft alRight alClient If the form or a component containing other components is resized, the components realign within the form or control Using the Align property is useful when you want a control to stay in one position on the form, even if the size of the form changes For example, you could use a panel component with a various controls on it as a tool palette By changing... palette always remains on the left side of the form and always equals the client height of the form Example This example moves a panel control named Panel1 to the bottom of the form and resizes it to fill the width of the form: procedure TForm1.Button1Click(Sender: TObject); begin Panel1.Align := alBottom; end; See also Alignment property Delphi Visual Component Library Reference 31 A Alignment property... PopupMenu1.Alignment := paRight; end; See also AutoPopup property, OnPopup event Delphi Visual Component Library Reference 33 A AllocMem function For field components Declaration property Alignment: TAlignment; The Alignment property is used by some data-aware controls to center, left-, or rightalign the data in a field Data-aware controls that support alignment include TDBGrid and TDBEdit AllocMem function... event See also BeforeDelete event AfterEdit event Applies to TTable, TQuery, TStoredProc components 28 Delphi Visual Component Library Reference AfterInsert event Declaration property AfterEdit: TDataSetNotifyEvent; The AfterEdit event is activated when a dataset finishes a call to the Edit method This event is the last action before Edit returns to the caller Note The event occurs before any changes . Introduction 1 Delphi for Windows Copyright Agreement Introduction This manual is a reference for the Delphi Visual Component Library (VCL) and the Delphi run-time library. Use it when. TQuery 4 Delphi Visual Component Library Most components are available from the Component palette. You will not find the following components on the Component palette, however: The TComponent component. to TScreen component Declaration property ActiveForm: TForm; 16 Delphi Visual Component Library Reference ActiveMDIChild property Run-time and read only. The ActiveForm property indicates which form

Ngày đăng: 16/04/2014, 11:15

TỪ KHÓA LIÊN QUAN