Difference between revisions of "Using Lazarus components"

From Lazarus wiki
Jump to navigationJump to search
m (Trev moved page Using components to Using Lazarus components without leaving a redirect: Clarified page content)
(WIP update)
Line 3: Line 3:
 
{{Warning|Tutorial under construction}}
 
{{Warning|Tutorial under construction}}
  
= Using components =
+
= What is a component? =
  
== Components vs Controls ==
+
A component is a [[Class]] - a module of code - typically comprising a data definition and a number of methods, which defines and describes a particular action or series of actions. Examples of components include buttons, labels, checkboxes, timers and dialogs.
  
While every '''control''' is a '''component''', not every component is a control. Confused? Let's clear up the confusion: a control is a visual component that a user of your application can see on a form can interact with (control) using the keyboard and/or the mouse. For example, a [[TButton]] which you drop on a [[TForm]] is a visible component that a user can see and interact with using the keyboard and/or mouse. Visual components are typically user interface elements like buttons, labels, check boxes, radio buttons and dialogs.
+
= Components vs Controls =
 +
 
 +
While every '''control''' is a '''component''', not every component is a control. Confused? Let's clear up the confusion: a control is a visual component that a user of your application can see and can interact with (control) using the keyboard and/or the mouse. For example, a [[TButton]] which you drop on a [[TForm]] is a visible component that a user can see and interact with using the keyboard and/or mouse. Visual components are typically user interface elements like buttons, labels, check boxes, radio buttons and dialogs.
  
 
On the other hand, there are components which have no visual control associated with them. For example, a [[TTimer]] which you drop on a TForm is a non-visual component. While you can see the TTimer at design time when you drop its icon on a form, there is nothing for the user to see or interact with at runtime.
 
On the other hand, there are components which have no visual control associated with them. For example, a [[TTimer]] which you drop on a TForm is a non-visual component. While you can see the TTimer at design time when you drop its icon on a form, there is nothing for the user to see or interact with at runtime.
  
== What is a component? ==
+
= Lazarus components =
  
A component is a [[Class]] - a module of code - typically comprising a data definition and a number of methods, which defines and describes a particular action or series of actions.
+
Lazarus comes with a number of useful components on its [[Component Palette]]. A list of the components can be found [[Lazarus_Components_Directory|here]]. There are also additional components which can be downloaded separately from the [[Components_and_Code_examples#Lazarus-CCR_Released_Components|Lazarus Code and Component Repository]] and installed.
  
== Lazarus components ==
+
There is also the Lazarus [[Online Package Manager]] which automates the downloading, installing and configuring of packages. [[Lazarus Packages]] are collections of units and components, containing information about how they can be compiled and how they can be used by projects or other packages or the IDE itself. The Online Package Manager can be found in the Lazarus IDE in the Package Menu.
  
Lazarus comes with a number of useful components on its [[Component Palette]]. A list of the components can be found [[Lazarus_Components_Directory|here]]. There are also additional components which can be downloaded separately from the [[Components_and_Code_examples#Lazarus-CCR_Released_Components|Lazarus Code and Component Repository]].
+
= Component properties =
  
== Component properties ==
+
Component properties determine how the component appears and how it behaves. At design time, most properties have a sensible default, but you can alter them using the Object Inspector
  
== Comnponent methods ==
+
= Component methods =
  
 
= See also =
 
= See also =
 +
 +
* [[How To Write Lazarus Component|How to write a Lazarus component]] - a tutorial describing how to create a new component.
 +
* [[Adding an About dialog as a property to a custom component]] - a tutorial for writers of Lazarus visual components.

Revision as of 03:36, 15 March 2020

English (en)

Warning-icon.png

Warning: Tutorial under construction

What is a component?

A component is a Class - a module of code - typically comprising a data definition and a number of methods, which defines and describes a particular action or series of actions. Examples of components include buttons, labels, checkboxes, timers and dialogs.

Components vs Controls

While every control is a component, not every component is a control. Confused? Let's clear up the confusion: a control is a visual component that a user of your application can see and can interact with (control) using the keyboard and/or the mouse. For example, a TButton which you drop on a TForm is a visible component that a user can see and interact with using the keyboard and/or mouse. Visual components are typically user interface elements like buttons, labels, check boxes, radio buttons and dialogs.

On the other hand, there are components which have no visual control associated with them. For example, a TTimer which you drop on a TForm is a non-visual component. While you can see the TTimer at design time when you drop its icon on a form, there is nothing for the user to see or interact with at runtime.

Lazarus components

Lazarus comes with a number of useful components on its Component Palette. A list of the components can be found here. There are also additional components which can be downloaded separately from the Lazarus Code and Component Repository and installed.

There is also the Lazarus Online Package Manager which automates the downloading, installing and configuring of packages. Lazarus Packages are collections of units and components, containing information about how they can be compiled and how they can be used by projects or other packages or the IDE itself. The Online Package Manager can be found in the Lazarus IDE in the Package Menu.

Component properties

Component properties determine how the component appears and how it behaves. At design time, most properties have a sensible default, but you can alter them using the Object Inspector

Component methods

See also