Difference between revisions of "TButton"
m (→Work with) |
(new "Work with a button") |
||
Line 13: | Line 13: | ||
==Work with a button== | ==Work with a button== | ||
− | + | A button is one of the most basic controls on a [[TForm|Form]]. Clicking with the mouse on it (or change with the [tab] key on the button and pressed it with enter), an action is triggered. This click is called an event. For this you need [[Event_order|event handler]] that are called after the jump. | |
+ | |||
+ | The event handler for a mouse click can be quite easily reached in which a double-click on the pasted Button (or in the Object Inspector, select the event OnClick of your Button). The event handler for a ''Button1'' on a form ''Form1'' will look like this: | ||
+ | <syntaxhighlight> | ||
+ | procedure TForm1.Button1Click(Sender: TObject); | ||
+ | begin | ||
+ | |||
+ | end; | ||
+ | </syntaxhighlight> | ||
+ | Between the statements '''begin''' and '''end''' you could write code that is called when '''Button1''' is clicked. | ||
+ | |||
+ | |||
+ | Almost all available beginner tutorials use TButtons as an easy entry into the [[Glossary#OO|Object Oriented Programming]] with Lazarus. Following tutorials are well suited for beginners to understand the use of buttons: | ||
+ | |||
+ | * [[Form_Tutorial#The_first_GUI_application|The first GUI application]] for absolute beginners | ||
+ | * [[Lazarus_Tutorial#Your_first_Lazarus_Program.21|Your first Lazarus program]] tutorial for Lazarus | ||
+ | * [[Object_Oriented_Programming_with_FreePascal_and_Lazarus#Programming_Example|Programming Example]] Object Oriented Programming with Free Pascal and Lazarus | ||
+ | |||
{{LCL Components Footer|TPopupMenu|TLabel}} | {{LCL Components Footer|TPopupMenu|TLabel}} | ||
Line 21: | Line 38: | ||
[[Category:LCL]] | [[Category:LCL]] | ||
[[Category:Components]] | [[Category:Components]] | ||
+ | --[[User:Michl|Michl]] 12:25, 15 May 2014 (CEST) |
Revision as of 12:25, 15 May 2014
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
français (fr) │
日本語 (ja) │
русский (ru) │
>> LCL Components >> TButton
This page explains how to use the TButton component. When I mention to click on something, unless I explicitly say to right-click, you always left-click on the item in question.
Description
A push button control.
Work with a button
A button is one of the most basic controls on a Form. Clicking with the mouse on it (or change with the [tab] key on the button and pressed it with enter), an action is triggered. This click is called an event. For this you need event handler that are called after the jump.
The event handler for a mouse click can be quite easily reached in which a double-click on the pasted Button (or in the Object Inspector, select the event OnClick of your Button). The event handler for a Button1 on a form Form1 will look like this:
procedure TForm1.Button1Click(Sender: TObject);
begin
end;
Between the statements begin and end you could write code that is called when Button1 is clicked.
Almost all available beginner tutorials use TButtons as an easy entry into the Object Oriented Programming with Lazarus. Following tutorials are well suited for beginners to understand the use of buttons:
- The first GUI application for absolute beginners
- Your first Lazarus program tutorial for Lazarus
- Programming Example Object Oriented Programming with Free Pascal and Lazarus
Return To: LCL Components | — Previous: TPopupMenu | Next: TLabel |
--Michl 12:25, 15 May 2014 (CEST)