Sign in Join
Wiki copytemporary

Lazarus Tutorial/hu: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11**Lazarus Tananyag**
22
33*Itt indul a Lazarus tananyag. Nyugodtan bővítsd a saját tapasztalataiddal.*
44
55## Áttekintés
66
7-<div style="text-align: justify;">
8-
97Ebben a cikkben megismerheted a Lazarus felépítését, alapvető működését.
108
119Ennek az oldalnak az elkészítéséhez az ["IDE fordítás a 0.9.28.2-es verzióhoz"](http://lazarus.freepascal.hu/index.php?option=com_remository&Itemid=36&func=fileinfo&id=32) honosítás lett felhasználva. A Lazarus 1.2.2 kiadásától kezdődően a frissített és jelentősen kibővített magyar fordítások részei a hivatalos kiadásnak, így az *egyes elemek kisebb-nagyobb mértékben eltérő szöveggel jelenhetnek meg*.
1210
1311A Lazarus egy ingyenes és nyílt forráskódú fejlesztőeszköz a Free Pascal fordítóhoz, ami szintén ingyenes és nyílt forráskódú. A Lazarus IDE ([képernyő kép](http://lazarus-ccr.sourceforge.net/kbdata/lazide.jpg)) egy stabil és lehetőségekben gazdag programozási környezet egyedülálló grafikus és konzolos alkalmazások készítéséhez. Jelenleg a Lazarus Linux-on, Mac OS X-en és Win32-n fut és egy testre szabható forráskód szerkesztőt, vizuális form tervezőt, csomagkezelőt, hibakeresőt és a Free Pascal-lal való teljes GUI integrációt kínál.
1412
15-</div>
16-
1713## Első lépések - Ez első Lazarus programod!
1814
19-<div style="text-align: justify;">
20-
2115(Köszönet User:Kirkpatc-nek)
2216
2317Szerezd meg, telepítsd ([[Installing Lazarus/hu|A Lazarus telepítése]]) és indítsd el a Lazarus-t, amely elérhetővé teszi egyúttal a Free Pascal fordítót is.
2418
2519Néhány ablak fog megjelenni az asztalon: a főmenü felül, az Objektum felügyelő a bal oldalon a Lazarus Forráskód szerkesztő a legnagyobb területen, és egy előre elkészített Form1 című ablak a forráskód szerkesztő mögött.
2620
2721A felső menüablakban, a menüsor alatt található egy sor lapfül. Ha nem a 'Standard' lap van kiválasztva, klikkelj rá az egérrel. Majd keresd meg a 'Button' (gomb) ikont (egy téglalap OK felirattal), és klikkelj rá az egérrel. Ezután klikkelj a Form1-re, a közepétől egy kicsit balra. Egy 'Button1' feliratú gomb fog megjelenni. Most újra klikkelj a 'Standard' lap 'Button' ikonjára, és helyezz el egy újabb gombot a Form1-en, most a közepétől egy kicsit jobbra: egy 'Button2' feliratú gomb jelenik meg.
2822
2923Most klikkelj a 'Button1'-re, hogy kiválaszd. Az Objektum felügyelő meg fogja jeleníti a Button1 objektum tulajdonságait. A felső részben található a 'Caption' tulajdonság, a megjelenített 'Button1' értékkel. Klikkelj rá a beviteli mezőre, és írd át a 'Button1'-et 'Klikklej rám'-ra. Ha ENTER-t nyomsz vagy egy másik beviteli mezőre klikkelsz, láthatod, hogy a Form1-en lévő Button1 felirata megváltozik 'Klikkelj rám'-ra. Most klikkelj az Események fülre az Objektum felügyelőben, hogy láthasd a különböző eseményeket, amelyeket a gombhoz lehet rendelni. Ezek: OnClick, OnEnter, OnExit stb. Válaszd ki az OnClick-hez tartozó beviteli mezőt; egy '...' feliratú gomb fog megjelenni. Amikor erre klikkelsz, automatikusan a Forráskód szerkesztőbe kerülsz, és a kurzor a következő kódrészleten belül lesz:
3024
3125``` pascal
3226procedure TForm1.Button1Click(Sender: TObject);
3327begin
3428 { most írd be: } Button1.caption := 'Klikkelj rám újra';
3529end;
3630```
3731
38-Nyomd meg az <span class="kbd">F12</span>-t, hogy visszakerülj a Form1 szerkesztőablakába, a Forráskód szerkesztőből.
32+Nyomd meg az `F12`-t, hogy visszakerülj a Form1 szerkesztőablakába, a Forráskód szerkesztőből.
3933
4034Most szerkeszd a Button2 tulajdonságait: klikkelj a Button2 feliratú gombra, hogy megjelenjenek a tulajdonságai az Objektum felügyelőben. Változtasd meg a Caption tulajdonságát 'Kilépés'-re. Most válaszd ki az Események fület, és klikkelj az OnClick melletti beviteli mezőre, majd a '...' gombra, és a Forráskód szerkesztőbe kerülsz a következő kódrészletbe:
4135
4236``` pascal
4337procedure TForm1.Button2Click(Sender: TObject);
4438begin
4539 { most írd be: } Close;
4640end;
4741```
4842
4943Most mentsd el a munkádat (ments gyakran!!) a Projekt -\> Projekt mentése másként menüponttal, majd add meg a fájlnevet: pl. projekt1.pas
5044
51-Nyomd meg újra az <span class="kbd">F12</span>-t, hogy a Form1 szerkesztőablakába kerülj. Most már készen állsz a fordításra. Ennek a legegyszerűbb módja a Projekt -\> Futtatás kiválasztása a felső menüből, vagy az F9 megnyomása. Így először le lesz fordítva a program, majd összefűzve, és futtatva.
45+Nyomd meg újra az `F12`-t, hogy a Form1 szerkesztőablakába kerülj. Most már készen állsz a fordításra. Ennek a legegyszerűbb módja a Projekt -\> Futtatás kiválasztása a felső menüből, vagy az F9 megnyomása. Így először le lesz fordítva a program, majd összefűzve, és futtatva.
5246
5347Az Üzenetek szöveges ablak fog megjelenni mindenféle fordítási információval, de nemsokára a Form1 megjelenik a rácspontok nélkül. Ez az alkalmazásod fő ablaka, várva, hogy megnyomd a gombokat, vagy bármi mást csinálj vele.
5448
5549Próbálj meg ráklikkelni a 'Klikkelj rám' feliratú gombra. A gomb felirata meg fog változni 'Klikkelj rám újra'-ra. Ha még egyszer ráklikkelsz, már nem változik meg a felirata.
5650
5751Most klikkelj a 'Kilépés' feliratú gombra. Az ablak be fog záródnia és a program kilép. Az eredeti Form1 szerkesztőablak megnyílik újra a rácspontokkal, készen állva a további szerkesztésre.
5852
5953### Második menet
6054
6155Nyisd meg újra a mentett projektedet. A Form1 ablakban klikkelj a 'Klikkelj rám' gombra (Button1), hogy jelöld ki. Válaszd ki az Események fület az Objektum felügyelőben, klikkelj az OnClick esemény beviteli mezőjébe, majd a megjelenő '...' gombra, hogy újra a megfelelő kódrészletbe kerülj.
6256
6357Szerkeszd át a kódot ezek szerint:
6458
6559``` pascal
6660procedure TForm1.Button1Click(Sender: TObject);
6761{ Használd a Tag tulajdonságot, 0-ra, majd 1-re való állításával }
6862begin
6963 if Button1.Tag = 0 then
7064 begin
7165 Button1.Caption := 'Klikkelj rám';
7266 Button1.Tag := 1;
7367 end
7468 else
7569 begin
7670 Button1.Caption := 'Klikkelj rám újra';
7771 Button1.Tag := 0;
7872 end;
7973end;
8074```
8175
8276Mentsd a munkádat, fordítsd le és futtasd a programot. A bal oldali gombon most a két felirat fog váltakozni minden klikkeléskor.
8377
8478A többi már rajtad múlik!
8579
8680Ha jobban szeretnél konzolos vagy szöveges Pascal programokat írni (például kezdő Pascal kurzust folytatsz, vagy programokat kell írnod batch módhoz, vagy rendszer-közeli használathoz), akkor is használhatod a Lazarus-t a szerkesztéshez, fordításhoz és futtatáshoz. Ideális környezetet teremt a Pascal programozáshoz. Lásd: [[Console Mode Pascal|Szöveges módú Pascal]].
8781
88-</div>
89-
9082## A szerkesztő
9183
92-<div style="text-align: justify;">
93-
9484Amikor először futtatod a Lazarus-t, egy sor különálló ablak fog megjelenni az asztalodon.
9585
9686Az első címe, ami az asztal felső részén helyezkedik el **Lazarus IDE vXXXXXX - project1** (ami az éppen megnyitott projekt neve szerint fog változni). Ez a fő vezérlő ablak, amely a főmenüt és a komponens palettát tartalmazza.
9787
98-<center>
99-
100-<figure>
101-<img src="LazMain_Win32_hu.png" title="LazMain_Win32_hu.png" />
102-<figcaption>LazMain_Win32_hu.png</figcaption>
103-</figure>
104-
105-</center>
88+![](/wiki-images/5/50/LazMain_Win32_hu.png)
10689
10790A címsor alatt található a főmenü, a szokásos menüpontokkal, és néhány Lazarus-specifikus menüvel. Ez alatt néhány gomb (ami bizonyos menüpontok gyors elérésére szolgál) és a komponens paletta.
10891
10992A főablak alatt, balra fog megjelenni az **Objektum felügyelő**:
11093
111-<figure>
112-<img src="LazObjInsp_Win32_hu.png" title="LazObjInsp_Win32_hu.png" />
113-<figcaption>LazObjInsp_Win32_hu.png</figcaption>
114-</figure>
94+![](/wiki-images/4/4f/LazObjInsp_Win32_hu.png)
11595
11696Az objektum felügyelőtől jobbra a **Forráskód szerkesztő**:
11797
118-<figure>
119-<img src="LazSrcEditor_Win32_hu.png" title="LazSrcEditor_Win32_hu.png" />
120-<figcaption>LazSrcEditor_Win32_hu.png</figcaption>
121-</figure>
98+![](/wiki-images/b/b0/LazSrcEditor_Win32_hu.png)
12299
123100Továbbá egy kisebb ablak a forráskód szerkesztő fölött (ez a **Form tervező**):
124101
125-<figure>
126-<img src="LazForm1_Win32_hu.png" title="LazForm1_Win32_hu.png" />
127-<figcaption>LazForm1_Win32_hu.png</figcaption>
128-</figure>
102+![](/wiki-images/2/28/LazForm1_Win32_hu.png)
129103
130-Ha ez nem látszik azonnal, megjelenítheted az <span class="kbd">F12</span> gombbal, ami a Forráskód szerkesztő és a Form tervező közötti átváltásra szolgál. A Form ablak az az ablak, ahol az alkalmazásod felületét fogod tervezni, a Forráskód szerkesztő pedig az, ahol az alkalmazásodhoz tartozó kódot. Az Objektum felügyelő működésének részletesebb leírása a Komponens paletta leírása után következik.
104+Ha ez nem látszik azonnal, megjelenítheted az `F12` gombbal, ami a Forráskód szerkesztő és a Form tervező közötti átváltásra szolgál. A Form ablak az az ablak, ahol az alkalmazásod felületét fogod tervezni, a Forráskód szerkesztő pedig az, ahol az alkalmazásodhoz tartozó kódot. Az Objektum felügyelő működésének részletesebb leírása a Komponens paletta leírása után következik.
131105
132106Amikor egy új projektet kezdesz (vagy először indítod el a Lazarus-t) egy alapértelmezett Form fog létrejönni, ami egy ablakból áll, rajta a komponensek elhelyezését segítő rácspontokkal, valamint az ablak címsorában megszokott gombokkal. Ha a Form-on belülre kattintasz, megjelennek a Form tulajdonságai az Objektum felügyelőben.
133107
134108További ablakok, amelyek megjelenhetnek a munkád során: a **[Projekt felügyelő](http://wiki.lazarus.freepascal.org/Image:LazProjInsp_Win32_hu.png)**, ami a projektedhez felhasznált fájlok részleteit tartalmazza, valamint lehetőséget nyújt új fájlok hozzáadásához és fájlok törléséhez a projektből; az **Üzenetek** ablak, ami a fordító üzeneteit, hibákat, jelentéseket tartalmaz a projekteddel kapcsolatosan; ha a Lazarus egy terminál ablakból lett elindítva, az eredeti terminál látható marad, és a részletes fordítói információk oda fognak kerülni.
135109
136-</div>
137-
138110## A főmenü
139111
140112For a detailed description of every menu item which is accessible from the Lazarus IDE Main Menu, please refer to the [[Main menu/hu]] page.
141113
142114## The Button bar
143115
144116A small toolbar area on the left of the main editor window, just below the Main Menu and to the left of the Component Palette, contains a set of buttons which replicate frequently-used Main Menu selections:
145117
146118
147119**New unit**, **Open** (with a down-arrow to display a drop-down list of recently used files), **Save**, **Save all**, **New Form**, **Toggle Form/Unit** (ie show either form or source code of Unit), **View Units**, **View Forms**, **Run** (ie compile and Run), **Pause**, **Step Into**, **Step over** (the last two are Debugger functions).
148120
149121## The Component Palette
150122
151123A Tabbed toolbar which displays a large number of icons representing commonly used components for building Forms.
152124
153125Each tab causes the display of a different set of icons, representing a functional group of components. The left-most icon in each tabbed group is an obliquely leftward-facing arrow, called the Selection Tool.
154126
155127If you allow the mouse cursor to hover over any of the icons on the Component Palette, without clicking on the icon, the title of that component will pop-up. Note that each title begins with a 'T' - this signifies 'Type' or more accurately 'Class' of the component. When you select a component for inclusion in a form, the [[Class]] is added to the **[[Type|type]]** section of the **[[Interface|interface]]** part of the [[Unit]] (usually as part of the overall TForm1), and an **instance** of that class is added to the **[[Var|var]]** section (usually as the variable Form1). Any **Methods** that you design to be used by the Form or its Components (ie [[Procedure|Procedures]] or [[Function|Functions]]) will be placed in the **[[Implementation|implementation]]** part of the Unit
156128
157129In the following list of the Components, you will find links to files that contain descriptions of the Units in which they are found. If you want to find out about the properties of a particular component, it is often worth looking at the Inheritance of that component and then inspecting the properties of the base type from which it is derived. For example, to understand TMaskEdit it is also useful to examine TCustomMaskEdit.
158130
159131**TABS** (the names are largely self-explanatory):
160132
161133- **[Standard](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/index-4.html)** (See [[Standard tab]] for components description)
162134
163-<center>
164-
165-<figure>
166-<img src="Component_Palette_Standart.png" title="Component_Palette_Standart.png" />
167-<figcaption>Component_Palette_Standart.png</figcaption>
168-</figure>
169-
170-</center>
135+![](/wiki-images/4/4d/Component_Palette_Standart.png)
171136
172137
173138*Frequently used components:* [TMainMenu](http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html), [TPopupMenu](http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html), [TButton](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html), [TLabel](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html), [TEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html), [TMemo](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html), [TToggleBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html), [TCheckBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html), [TRadioButton](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html), [TListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html), [TComboBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html), [TScrollBar](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html), [TGroupBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html), [TRadioGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html), [TCheckGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html), [TPanel](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html), [TActionList](http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html)
174139
175140- **[Additional](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/index-4.html)** (See [[Additional tab]] for components description)
176141
177-<center>
178-
179-<figure>
180-<img src="Component_Palette_Additional.png" title="Component_Palette_Additional.png" />
181-<figcaption>Component_Palette_Additional.png</figcaption>
182-</figure>
183-
184-</center>
142+![](/wiki-images/7/7d/Component_Palette_Additional.png)
185143
186144
187145*More, often-used components:* [TBitBtn](http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html), [TSpeedButton](http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html), [TStaticText](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html), [TImage](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html), [TShape](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html), [TBevel](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html), [TPaintBox](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html), [TNotebook](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html), [TLabeledEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html), [TSplitter](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html), [TTrayIcon](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttrayicon.html), [TMaskEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/maskedit/tmaskedit.html), [TCheckListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html), [TScrollBox](http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscrollbox.html), [TApplicationProperties](http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html), [TStringGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html), [TDrawGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html), [TPairSplitter](http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html), [TColorBox](http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorbox.html), [TColorListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorlistbox.html), [TChart](http://lazarus-ccr.sourceforge.net/docs/lcl/chart/index.html)
188146
189147- **[Common Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/index-4.html)** (See [[Common Controls tab]] for components description)
190148
191-<center>
192-
193-<figure>
194-<img src="Component_Palette_Common_Controls.png" title="Component_Palette_Common_Controls.png" />
195-<figcaption>Component_Palette_Common_Controls.png</figcaption>
196-</figure>
197-
198-</center>
149+![](/wiki-images/4/4a/Component_Palette_Common_Controls.png)
199150
200151
201152[TTrackBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttrackbar.html), [TProgressBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tprogressbar.html), [TTreeView](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttreeview.html), [TListView](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tlistview.html), [TStatusBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tstatusbar.html), [TToolBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttoolbar.html), [TUpDown](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tupdown.html), [TPageControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tpagecontrol.html), [TTabControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttabcontrol.html), [THeaderControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/theadercontrol.html), [TImageList](http://lazarus-ccr.sourceforge.net/docs/lcl/controls/timagelist.html), [TPopupNotifier](http://lazarus-ccr.sourceforge.net/docs/lcl/popupnotifier/index.html)
202153
203154- **[Dialogs](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/index-4.html)** (See [[Dialogs tab]] for components description)
204155
205-<center>
206-
207-<figure>
208-<img src="Component_Palette_Dialogs.png" title="Component_Palette_Dialogs.png" />
209-<figcaption>Component_Palette_Dialogs.png</figcaption>
210-</figure>
211-
212-</center>
156+![](/wiki-images/7/72/Component_Palette_Dialogs.png)
213157
214158
215159[TOpenDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/topendialog.html), [TSaveDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tsavedialog.html), [TSelectDirectoryDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tselectdirectorydialog.html), [TColorDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcolordialog.html), [TFontDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfontdialog.html), [TFindDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfinddialog.html), [TReplaceDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/treplacedialog.html), [TOpenPictureDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/topenpicturedialog.html), [TSavePictureDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tsavepicturedialog.html), [TCalendarDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalendardialog.html), [TCalculatorDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalculatordialog.html), [TPrinterSetupDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html), [TPrintDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintdialog.html), [TPageSetupDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html)
216160
217161Several useful **[Dialog](http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples)** procedures or functions don't appear on the Palette, but are easily used as direct calls from your source program.
218162
219163For several good examples of the use of Components see the \$LazarusPath/lazarus/examples subdirectory of your source installation. Many of the programs show how to use dialogs and other components directly without using the IDE and component palette or having a separate form definition file: all the components are fully and explicitly defined in the main Pascal program. Other example programs make full use of the IDE.
220164
221165Some examples don't work straight away: you may need to play about with paths and permissions of files or directories. If you want to compile any of the examples, make sure that you have read/write/execute permissions for the files and directories, or copy the files to a directory where you do have the appropriate permissions.
222166
223167Try running the 'testall' program to see a menu of the available components together with small example test forms for most of them; then inspect the code to find out how they work!
224168
225169- **Misc**
226170
227-<center>
228-
229-<figure>
230-<img src="Component_Palette_Misc.png" title="Component_Palette_Misc.png" />
231-<figcaption>Component_Palette_Misc.png</figcaption>
232-</figure>
233-
234-</center>
171+![](/wiki-images/8/8e/Component_Palette_Misc.png)
235172
236173
237174[TColorButton](http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt), [TSpinEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tspinedit.html), [TFloatSpinEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tfloatspinedit.html), [TArrow](http://lazarus-ccr.sourceforge.net/docs/lcl/arrow/tarrow.html), [TCalendar](http://lazarus-ccr.sourceforge.net/docs/lcl/calendar/tcalendar.html), [TEditButton](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/teditbutton.html), [TFileNameEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tfilenameedit.html), [TDirectoryEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdirectoryedit.html), [TDateEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.html), [TCalcEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tcalcedit.html), [TFileListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/filectrl/tfilelistbox.html), [TXMLPropStorage](http://lazarus-ccr.sourceforge.net/docs/lcl/xmlpropstorage/txmlpropstorage.html), [TIniPropStorage](http://lazarus-ccr.sourceforge.net/docs/lcl/inipropstorage/tinipropstorage.html), [TBarChart](http://lazarus-ccr.sourceforge.net/docs/lcl/chart/tbarchart.html), [TButtonPanel](http://lazarus-ccr.sourceforge.net/docs/lcl/buttonpanel/tbuttonpanel.html), TIDEDialogLayoutStorage
238175
239176- **[Data Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/index-4.html)**
240177
241-<center>
242-
243-<figure>
244-<img src="Component_Palette_DataControls.png" title="Component_Palette_DataControls.png" />
245-<figcaption>Component_Palette_DataControls.png</figcaption>
246-</figure>
247-
248-</center>
178+![](/wiki-images/6/62/Component_Palette_DataControls.png)
249179
250180
251181*Data-aware components, which largely replicate the Standard and Additional groups but are applicable to Databases:* [TDBNavigator](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbnavigator.html), [TDBText](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbtext.html), [TDBEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbedit.html), [TDBMemo](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbmemo.html), [TDBImage](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbimage.html), [TDBListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdblistbox.html), [TDBComboBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcombobox.html), [TDBCheckBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcheckbox.html), [TDBRadioGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbradiogroup.html), [TDBCalendar](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcalendar.html), [TDBGroupBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbgroupbox.html), [TDBGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/dbgrids/tdbgrid.html)
252182
253183- **Data Access**
254184
255-<center>
256-
257-<figure>
258-<img src="Component_Palette_DataAccess.png" title="Component_Palette_DataAccess.png" />
259-<figcaption>Component_Palette_DataAccess.png</figcaption>
260-</figure>
261-
262-</center>
185+![](/wiki-images/c/cc/Component_Palette_DataAccess.png)
263186
264187
265188TDatasource, TMemDataset, TSdfDataSet, TFixedFormatDataSet, TDbf
266189
267190- **[[System]]**
268191
269-<center>
270-
271-<figure>
272-<img src="Component_Palette_System.png" title="Component_Palette_System.png" />
273-<figcaption>Component_Palette_System.png</figcaption>
274-</figure>
275-
276-</center>
192+![](/wiki-images/f/fe/Component_Palette_System.png)
277193
278194
279195[TTimer](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttimer.html), [TIdleTimer](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tidletimer.html), [TLazComponentQueue](http://lazarus-ccr.sourceforge.net/docs/lcl/lresources/tlazcomponentqueue.html), [THtmlHelpDatabase](http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlhelpdatabase.html), [THtmlBrowserHelpViewer](http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlbrowserhelpviewer.html), [TProcessUTF8](http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tprocessutf8.html), [TAsyncProcess](http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tasyncprocess.html), [[doc:fcl/process/tprocess.html|TProcess]], TSimpleIPCClient, TSimpleIPCServer, TXMLConfig, TEventLog
280196
281197- **SynEdit**
282198
283-<center>
284-
285-<figure>
286-<img src="Component_Palette_SynEdit.png" title="Component_Palette_SynEdit.png" />
287-<figcaption>Component_Palette_SynEdit.png</figcaption>
288-</figure>
289-
290-</center>
199+![](/wiki-images/2/22/Component_Palette_SynEdit.png)
291200
292201
293202*A group of components to help interfacing with other languages and software tools. SynEdit is an advanced multi-line edit control, for Borland Delphi, Kylix and C++Builder. It supports Syntax Highlighting and code completion, and includes exporters for html, tex and rtf. It is a full-VCL/CLX control, meaning it is not a wrapper for Microsoft Windows controls, and no run-time library is required; this make SynEdit a crossplatform component. Compatibility with FreePascal is also planned, and SynEdit is the edit component in Lazarus IDE.* see [synedit at sourceforge](http://synedit.sourceforge.net). : TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynFreePascalSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynVBSyn, TSynAnySyn, TSynMultiSyn
294203
295204### How To Use the Palette
296205
297206To use the Palette, there must be an open form on view in the editor (if there isn't one, select File -\> New Form). Click on the icon in the appropriate tab of the Palette for the component you want to use, then click on the Form, near where you want the component to appear. When the desired component appears, you can select it by clicking with the mouse, then move it to the exact place on the Form where you want it and adjust its size. Adjustments can be made to the appearance either by altering the picture itself on the Form using the mouse, or by changing the relevant Property in the Object Editor for that component.
298207
299208If you install additional components, either those you have written yourself, or some coming as a package from some other source, then extra tabs with the relevant icons will appear in your Component Palette. These new components can be selected and used on your forms in the same way as those supplied by default.
300209
301210## How to use Standard Controls, Common Controls and Extended Controls
302211
303-The Units <i>StdCtrls</i>, <i>ComCtrls</i> and <i>ExtCtrls</i> contain definitions and descriptions of many of the most commonly used controls for constructing Forms and other Objects in Lazarus Applications.
212+The Units StdCtrls, ComCtrls and ExtCtrls contain definitions and descriptions of many of the most commonly used controls for constructing Forms and other Objects in Lazarus Applications.
304213
305-Many of the final target controls that the application developer wants to use, such as <i>TButton</i>, <i>TMemo</i>, <i>TScrollBar</i> etc, have a corresponding ancestor class such as <i>TCustomButton</i>, <i>TCustomMemo</i> or <i>TCustomScrollBar</i>. Several of the properties and methods relevant to the final target control are defined (and explained) more fully in the <i>TCustomXXX</i> class, and are <b>inherited</b> by the final target control.
214+Many of the final target controls that the application developer wants to use, such as TButton, TMemo, TScrollBar etc, have a corresponding ancestor class such as TCustomButton, TCustomMemo or TCustomScrollBar. Several of the properties and methods relevant to the final target control are defined (and explained) more fully in the TCustomXXX class, and are inherited by the final target control.
306215
307216If you drop a component on the form editor you don't need to add code explicitly to create it. The component is automatically created by the IDE together with the form, and destroyed when the form is destroyed.
308217
309218However, if you create the component yourself by code don't forget to free it when it is no longer needed.
310219
311220If you place a component on the Form Designer and look at the Object Inspector, you can observe the properties change as you move the component around.
312221
313222For example, if you place a button (TButton) on the form, click on it to select it, then move it around the form with the mouse, you can watch the values of Top and Left change in the Object Inspector to reflect the new position. If you use the object's re-sizing bars to adjust its size, you can watch the Height and Width properties change as well.
314223
315224On the other hand, by using the Object Inspector, you can select the value associated with a property such as height, and type in a new value; you can watch the size of the object on the form change to reflect the new value.
316225
317226You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example
318227
319228`         ``Form1.Button1.Height := 48;`\
320229`         `
321230
322231If you type this new value into the Source Editor and then look back at the Form Designer, you will see that the button on the Form has taken the new size. The new value will also be shown in the Object Inspector.
323232
324233In summary, there are usually about three different ways to determine each property of an object:
325234
326235- by using the mouse,
327236- by setting the values in the Object Inspector,
328237- or explicitly by writing code.
329238
330239The components defined in these Units have several properties that are common to most of them, and other properties that are specific to the individual components. We shall describe the most common ones here. Unusual or control-specific properties will be described for the individual controls.
331240
332-Additional Help can always be obtained by selecting a property or keyword, in either the Object Inspector or the Source Editor, and pressing <span class="kbd">F1</span>. You will be taken by your Help browser to the appropriate page in the documentation.
241+Additional Help can always be obtained by selecting a property or keyword, in either the Object Inspector or the Source Editor, and pressing `F1`. You will be taken by your Help browser to the appropriate page in the documentation.
333242
334243If the description of a property on that page is insufficient, you can navigate to the corresponding description in the ancestor classes, by selecting the links in the Inheritance listing or by selecting the ancestor Type in the declaration of the object.
335244
336-`           `<i>`Constructors`</i>
337-
338-`such as `<i>`Create`</i>` allocate memory and system resources needed by the object. They also call the constructor of any sub-objects present in the class.`
339-
340-`           `<i>`Destructors:`</i>
341-
342-`remove the object and de-allocate memory and other resources. If you call `<i>`Destroy`</i>` for an object which hasn't being initialized yet it will generate an error. Always use the `<i>`Free`</i>` method to deallocate objects, because it checks whether an object's value is `<b>`nil`</b>` before invoking `<i>`Destroy`</i>`.`
343-
344-Take the following precautions when creating your own <i>Destroy</i> method:
345-
346-- Declare <i>Destroy</i> with the <b>override</b> directive, because it is a <b>virtual</b> method.
347-- Always call '<i>inherited Destroy;</i>' as the last thing on the destructor code.
348-- Be aware that an <i>exception</i> may be raised on the <i>constructor</i> in case there is not enought memory to create an object, or something else goes wrong. If the <i>exception</i> is not handled inside the constructor, the object will be only partially built. In this case <i>Destroy</i> will be called when you weren't expecting it, so your destructor must check if the resources were really allocated before disposing of them.
349-- Remember to call <i>Free</i> for all objects created on the constructor.
350-
351-\
352-
353-<table>
354-
355-<caption>
356-
357-<b>Some commonly listed properties</b>
358-
359-</caption>
360-
361-<tr>
362-
363-<td>
245+`           ``Constructors`
364246
365-<b>Property</b>
247+`such as ``Create`` allocate memory and system resources needed by the object. They also call the constructor of any sub-objects present in the class.`
366248
367-</td>
249+`           ``Destructors:`
368250
369-<td>
251+`remove the object and de-allocate memory and other resources. If you call ``Destroy`` for an object which hasn't being initialized yet it will generate an error. Always use the ``Free`` method to deallocate objects, because it checks whether an object's value is ``nil`` before invoking ``Destroy``.`
370252
371-<b>Meaning</b>
253+Take the following precautions when creating your own Destroy method:
372254
373-</td>
255+- Declare Destroy with the override directive, because it is a virtual method.
256+- Always call 'inherited Destroy;' as the last thing on the destructor code.
257+- Be aware that an exception may be raised on the constructor in case there is not enought memory to create an object, or something else goes wrong. If the exception is not handled inside the constructor, the object will be only partially built. In this case Destroy will be called when you weren't expecting it, so your destructor must check if the resources were really allocated before disposing of them.
258+- Remember to call Free for all objects created on the constructor.
374259
375-</tr>
260+Some commonly listed properties
376261
377-<tr>
262+Property
378263
379-<td>
264+Meaning
380265
381266Action
382267
383-</td>
384-
385-<td>
386-
387268The main action or event associated with the object. For example selecting an 'Exit' Button might cause the 'Close' action
388269
389-</td>
390-
391-</tr>
392-
393-<tr>
394-
395-<td>
396-
397270Align
398271
399-</td>
400-
401-<td>
402-
403272Defines the way in which an object is to be lined up with the parent object. Possible values are alTop (placed at the top and using the full available width), alBottom, alLeft (placed at the left and using the full available height), alRight. alNone (place anywhere on parent control) or alClient (takes all available space next to controls aligned to top, bottom, left or right)
404273
405-</td>
406-
407-</tr>
408-
409-<tr>
410-
411-<td>
412-
413274Anchor
414275
415-</td>
416-
417-<td>
418-
419-Used to keep a control a certain distance from the defined edges of a parent control, when the parent is resized. For example <b>\[akBottom, akRight\]</b> will keep the control a fixed distance from the bottom right corner.
420-
421-</td>
422-
423-</tr>
424-
425-<tr>
426-
427-<td>
276+Used to keep a control a certain distance from the defined edges of a parent control, when the parent is resized. For example \[akBottom, akRight\] will keep the control a fixed distance from the bottom right corner.
428277
429278AutoSelect
430279
431-</td>
432-
433-<td>
434-
435280When True, an editing control will select all its text when it receives focus or when the Enter key is pressed.
436281
437-</td>
438-
439-</tr>
440-
441-<tr>
442-
443-<td>
444-
445282AutoSelected
446283
447-</td>
448-
449-<td>
450-
451284True indicate that the edit or combobox control has just performed an AutoSelect operation so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text.
452285
453-</td>
454-
455-</tr>
456-
457-<tr>
458-
459-<td>
460-
461286BorderSpacing
462287
463-</td>
464-
465-<td>
466-
467-The space around the edge between an <i>Anchored</i> control and its parent.
468-
469-</td>
470-
471-</tr>
472-
473-<tr>
474-
475-<td>
288+The space around the edge between an Anchored control and its parent.
476289
477290Caption
478291
479-</td>
480-
481-<td>
482-
483292The text that is displayed on or near the control; it should preferably give some clue as to the function of the control, or an instruction such as 'Close' or 'Execute'. By default Caption is set to be the same as the 'Name' property, and the application programmer should substitute meaningful text instead of the default values.
484293
485-</td>
486-
487-</tr>
488-
489-<tr>
490-
491-<td>
492-
493294CharCase
494295
495-</td>
496-
497-<td>
498-
499296Indicates how text is displayed in a text editing control: Normal (retaining the case of the letters typed by the user), converted to uppercase, or converted to lowercase
500297
501-</td>
502-
503-</tr>
504-
505-<tr>
506-
507-<td>
508-
509298Constraints
510299
511-</td>
512-
513-<td>
514-
515300Sets the minimum and maximum sizes for a control. If a control is resized the new dimensions are always within the ranges given here. You should take care when setting these options that they do not conflict with the Anchors and Align settings.
516301
517-</td>
518-
519-</tr>
520-
521-<tr>
522-
523-<td>
524-
525302Color
526303
527-</td>
528-
529-<td>
530-
531304The Colour to be used to draw the control or to write the text it contains.
532305
533-</td>
534-
535-</tr>
536-
537-<tr>
538-
539-<td>
540-
541306Enabled
542307
543-</td>
544-
545-<td>
546-
547-A Boolean property to determine whether or not a control is capable of being selected and performing an action. If it is not <i>Enabled</i>, it is often <b>Grayed</b> out on the Form.
548-
549-</td>
550-
551-</tr>
552-
553-<tr>
554-
555-<td>
308+A Boolean property to determine whether or not a control is capable of being selected and performing an action. If it is not Enabled, it is often Grayed out on the Form.
556309
557310Font
558311
559-</td>
560-
561-<td>
562-
563312The Font to be used for writing the text associated with the control - either the caption or label, or the text-strings contained within the control. The entry on the Object Inspector usually has a (+) box on the left, and selecting this box reveals further options such as character set, colour and size.
564313
565-</td>
566-
567-</tr>
568-
569-<tr>
570-
571-<td>
572-
573314Hint
574315
575-</td>
576-
577-<td>
578-
579316A short piece of informative pop-up text that appears if the mouse-cursor hovers over the control.
580317
581-</td>
582-
583-</tr>
584-
585-<tr>
586-
587-<td>
588-
589318Items
590319
591-</td>
592-
593-<td>
594-
595320The list of 'Things' that the object contains, such as a group of images, a series of lines of text, a number of actions in an actionlist, etc
596321
597-</td>
598-
599-</tr>
600-
601-<tr>
602-
603-<td>
604-
605322Lines
606323
607-</td>
608-
609-<td>
610-
611324An array of strings, containing the textual data in controls with more than a single line of data, such as an Edit-Box or a Combo-Box. The array is zero-indexed, ie the lines are numbered \[0..numLines-1\]
612325
613-</td>
614-
615-</tr>
616-
617-<tr>
618-
619-<td>
620-
621326Name
622327
623-</td>
624-
625-<td>
626-
627328The identifier by which the control is known in the program. The IDE gives it a default name based on the underlying type, for example successive instances of TBitButton would be named Form1.BitBitton1 and Form1.BitButton2; it is up to the application programmer to give them more meaningful names such as ExitButton or OKButton. By default the Name of the control is applied to the Caption for the control, but the text of the Caption may be changed separately.
628329
629-</td>
630-
631-</tr>
632-
633-<tr>
634-
635-<td>
636-
637330PopUpMenu
638331
639-</td>
640-
641-<td>
642-
643332A window containing context-sensitive menu information that pops up when the right mouse button is clicked on the object.
644333
645-</td>
646-
647-</tr>
648-
649-<tr>
650-
651-<td>
652-
653334Position (or Top, Left)
654335
655-</td>
656-
657-<td>
658-
659336Determines where the control is located on the parent form or window
660337
661-</td>
662-
663-</tr>
664-
665-<tr>
666-
667-<td>
668-
669338ReadOnly
670339
671-</td>
672-
673-<td>
674-
675340Boolean property which, if True, signifies that the contents of the control can be read by the user or the calling routine, but cannot be written or changed.
676341
677-</td>
678-
679-</tr>
680-
681-<tr>
682-
683-<td>
684-
685342ShowHint
686343
687-</td>
688-
689-<td>
690-
691344Allows a small window containing a context-sensitive Help or other description to be displayed when the mouse cursor 'hovers' over the control.
692345
693-</td>
694-
695-</tr>
696-
697-<tr>
698-
699-<td>
700-
701346Size (or Height and Width)
702347
703-</td>
704-
705-<td>
706-
707348The dimensions of the control
708349
709-</td>
710-
711-</tr>
712-
713-<tr>
714-
715-<td>
716-
717350Style
718351
719-</td>
720-
721-<td>
722-
723352The options available for Style depend upon the sort of Control being considered: for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc.
724353
725-</td>
726-
727-</tr>
728-
729-<tr>
730-
731-<td>
732-
733354TabOrder
734355
735-</td>
736-
737-<td>
738-
739356Integer defining where in the sequence of tabs on the Form this control is to lie
740357
741-</td>
742-
743-</tr>
744-
745-<tr>
746-
747-<td>
748-
749358TabStop
750359
751-</td>
752-
753-<td>
754-
755360Boolean property which if True places this control in the sequence of objects that the user can reach by successively pressing the Tab key
756361
757-</td>
758-
759-</tr>
760-
761-<tr>
762-
763-<td>
764-
765362Text
766363
767-</td>
768-
769-<td>
770-
771-The String of Text that represents the actual data that this control contains. Applies particularly to Text, Memo and StringList types of object. Most of the editing operations (such as <i>Select</i>, <i>Clear</i>, <i>Cut</i>, <i>Copy</i>) are performed in this part of the object, which holds the actual string being edited. If the control contains more than a single line of text, for example <i>TMemo</i> or <i>TComboBox</i>, then the textual elements are arranged as an array of strings (zero-indexed, ie numbered from \[0..numLines-1\]) in <i>Lines</i>.
772-
773-</td>
774-
775-</tr>
776-
777-<tr>
778-
779-<td>
364+The String of Text that represents the actual data that this control contains. Applies particularly to Text, Memo and StringList types of object. Most of the editing operations (such as Select, Clear, Cut, Copy) are performed in this part of the object, which holds the actual string being edited. If the control contains more than a single line of text, for example TMemo or TComboBox, then the textual elements are arranged as an array of strings (zero-indexed, ie numbered from \[0..numLines-1\]) in Lines.
780365
781366Visible
782367
783-</td>
784-
785-<td>
786-
787368If true, the object can be seen on the Form; if False, object is hidden
788369
789-</td>
790-
791-</tr>
792-
793-<tr>
794-
795-<td>
796-
797370WordWrap
798371
799-</td>
800-
801-<td>
802-
803372Logical flag to show whether or not word-wrap is enabled, ie if a word comes close to the end of a line and is going to be too long for the line, it is wrapped down to the next line.
804373
805-</td>
806-
807-</tr>
808-
809-</table>
810-
811374Many actions are commonly listed in the 'Events' tab of the Object Inspector. If you select an entry in the list, a ComboBox appears with a DropDown list showing any actions that have aleady been defined, and allowing you to choose one to be associated with this event. Alternatively you can select the ellipsis (three dots ...) and you will be taken to an area of the Source Editor where you can begin typing your own action instructions for the selected event.
812375
813376While a large number of events is available for any given control, in practice it is only necessary to populate a few of them. For most controls, it is sufficient to provide coding for 'OnClick'; for more complex controls it may be necessary also to provide for 'OnEntry' (when the mouse cursor enters the Control and gives it focus) and 'OnExit' (when the mouse cursor leaves the Control; or you may need to write an event handler for 'OnChange' or 'OnScroll', depending on the nature of the particular control with which you are dealing.
814377
815378The pop-up menu that appears when you right-click an object in the Form Designer has, as its first item: 'Create default event' and selecting this option will have the same effect as selecting the ellipsis in the Object Inspector for the default event, usually OnClick: you are taken to the Implementation area of the Source Editor where you can type the code for the event handler.
816379
817-A common strategy in Object-Oriented programming is to provide an <i>ActionList</i> with the facility for entering, removing or editing a number of pre-defined actions from which the most appropriate can be selected to use in any particular instance.
818-
819-\
820-
821-<table>
822-
823-<caption>
824-
825-<b>Some commonly listed Actions</b>
826-
827-</caption>
828-
829-<tr>
830-
831-<td>
832-
833-<b>Action</b>
834-
835-</td>
836-
837-<td>
838-
839-<b>Meaning</b>
380+A common strategy in Object-Oriented programming is to provide an ActionList with the facility for entering, removing or editing a number of pre-defined actions from which the most appropriate can be selected to use in any particular instance.
840381
841-</td>
382+Some commonly listed Actions
842383
843-<tr>
384+Action
844385
845-<td>
386+Meaning
846387
847388OnChange
848389
849-</td>
850-
851-<td>
852-
853390Action to be taken if any change is detected (eg mouse move, mouse click, key press, edit text, alter picture, etc)
854391
855-</td>
856-
857-</tr>
858-
859-<tr>
860-
861-<td>
862-
863392OnClick
864393
865-</td>
866-
867-<td>
868-
869394Action to be taken when the (left) mouse button is clicked. This is usually the main or default action of the control; for example clicking on a button or checkbox initiates the action associated with the checkbox. It may alternatively initate a process of selection, for instance in a TextBox or Memo, or signal the beginning of painting with a Pen or Brush.
870395
871-</td>
872-
873-</tr>
874-
875-<tr>
876-
877-<td>
878-
879396Click
880397
881-</td>
882-
883-<td>
884-
885398A method to emulate in code the effect of clicking on a control. This method is most often found in Button-type controls (TButton, TBitBtn, TSpeedButton etc). A procedure can be written that calls the same code as the OnClick action. This facility can be particularly useful if the activation of one control by clicking causes a cascade of other controls to be activated, and the Click method can be used to initiate the action rather than having the user explicitly click on a lot of controls.
886399
887-</td>
888-
889-</tr>
890-
891-<tr>
892-
893-<td>
894-
895400OnDragDrop
896401
897-</td>
898-
899-<td>
900-
901402Action to be taken during Drag-Drop manoeuvres, ie when the mouse is used to 'capture' an item or some text etc and move it around the screen to a new location.
902403
903-</td>
904-
905-</tr>
906-
907-<tr>
908-
909-<td>
910-
911404OnEntry
912405
913-</td>
914-
915-<td>
916-
917406Action to be taken when the mouse cursor enters the area occupied by the object, usually transfering focus to that object. This might include changes in the appearance of the object such as highlighting or raising the border.
918407
919-</td>
920-
921-</tr>
922-
923-<tr>
924-
925-<td>
926-
927408OnExit
928409
929-</td>
930-
931-<td>
932-
933410Action to be taken when the mouse moves out of the area of the object, usually transferring focus out of the object.
934411
935-</td>
936-
937-</tr>
938-
939-<tr>
940-
941-<td>
942-
943412OnKeyPress
944413
945-</td>
946-
947-<td>
948-
949414Action to be taken for any key-press. Subtly different from OnKeyDown, which simply responds to a key being down, whether or not it was already down when focus was given to this control. OnKeyPress requires that a key becomes pressed while focus is in this control.
950415
951-</td>
952-
953-</tr>
954-
955-<tr>
956-
957-<td>
958-
959416OnKeyDown
960417
961-</td>
962-
963-<td>
964-
965418Action to be taken if a key is down while focus is in this control. Subtly different from OnKeyPress - for example the key might already have been down when focus entered this control, whereas OnKeyPress requires the key to become pressed while focus is in the control.
966419
967-</td>
968-
969-</tr>
970-
971-<tr>
972-
973-<td>
974-
975420On Key Up
976421
977-</td>
978-
979-<td>
980-
981422Action to be taken if a key is up (ie not pressed) while focus is in this control.
982423
983-</td>
984-
985-</tr>
986-
987-<tr>
988-
989-<td>
990-
991424OnMouseMove
992425
993-</td>
994-
995-<td>
996-
997426On Mouse Down - Action to be taken if the mouse cursor moves while focus is in this control.
998427
999-</td>
1000-
1001-</tr>
1002-
1003-<tr>
1004-
1005-<td>
1006-
1007428OnMouseDown
1008429
1009-</td>
1010-
1011-<td>
1012-
1013430Action to be taken if the mouse button is down while focus is in this control.
1014431
1015-</td>
1016-
1017-</tr>
1018-
1019-<tr>
1020-
1021-<td>
1022-
1023432OnMouseUp
1024433
1025-</td>
1026-
1027-<td>
1028-
1029434Action to be taken if the mouse button is up while the cursor is over this control. Implies that the mouse button was previously down and has been released. The case where the cursor enters the control but the mouse button has not yet been pressed is covered by OnEntry or OnMouseEnter.
1030435
1031-</td>
1032-
1033-</tr>
1034-
1035-<tr>
1036-
1037-<td>
1038-
1039436OnResize
1040437
1041-</td>
1042-
1043-<td>
1044-
1045438Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc.
1046439
1047-</td>
1048-
1049-</tr>
1050-
1051-</table>
1052-
1053440## How to use Menus
1054441
1055442Hints for creating Menus for your Forms
1056443
1057444*TMainMenu* is the Main Menu that appears at the top of most forms; form designers can customise by choosing various menu items. *TPopupMenu* is a menu window that pops up with pertinent, usually context-sensitive, details and choices when the right mouse button is clicked near a control
1058445
1059446Main Menu is a non-visible component : that is, if the icon is selected from the Component Palette and placed on the Form, it will not appear at Run-time. Instead, a Menu bar with a structure defined by the Menu Editor will appear. Popup menus, placed on the form by selecting the icon from the Component Palette, do not appear at all unless the right mouse button is clicked on a control that owns such a menu.
1060447
1061448To see the Menu Editor, right-click on the Main Menu or Popup Menu icon on your Form. A pop-up box appears, that invites you to enter items into the Menu bar.
1062449
1063450An Edit box is displayed, containing a Button labelled New Item1. If you right-click on that box, a pop-up menu is displayed that allows you to add a new item before or after (along the same level) or create a sub-menu with the opportunity to add further items below (or above) the new item in a downward column.
1064451
1065452Any or all of the *MenuItems* that you add can be configured using the Object Inspector.
1066453
1067454At the least you should give each item a *Caption* which will appear on the Menu Bar (you may also wish to give it a more meaningful *Name*). The caption should indicate the activity to be selected, such as "File Open" or "Close", "Run" or "Quit"
1068455
1069-If you want a particular letter in the Caption to be associated with a shortcut key, that letter should be preceded by an ampersand. The Menu item at run-time will appear with the shortcut letter underlined, and hitting that letter key will have the same effect as selecting the menu item. Alternatively you can choose a shortcut key sequence (such as <span class="kbd">Ctrl</span>+<span class="kbd">C</span> for Copy or <span class="kbd">Ctrl</span>+<span class="kbd">V</span> for Paste - the standard Keyboard shortcuts) with the *ShortCut* property of the MenuItem.
456+If you want a particular letter in the Caption to be associated with a shortcut key, that letter should be preceded by an ampersand. The Menu item at run-time will appear with the shortcut letter underlined, and hitting that letter key will have the same effect as selecting the menu item. Alternatively you can choose a shortcut key sequence (such as `Ctrl`+`C` for Copy or `Ctrl`+`V` for Paste - the standard Keyboard shortcuts) with the *ShortCut* property of the MenuItem.
1070457
1071458It is often helpful to use the Menu controls in conjuction with an *ActionList* which contains a series of standard or customised *Actions*. Menu Items can be linked in the Object Inspector to Actions on the list, and the same actions can be linked to *Buttons*, *ToolBar Buttons*, *SpeedButtons* etc. It is obviously economic of effort to re-use the same code to respond to the various events, rather than writing separate *OnClick* event handlers for each individual control.
1072459
1073460By default a number of standard actions is pre-loaded from *StdActns* or, if DataAware controls are being used, from *DBActns*, and these can be chosen using the ActionList editor which appears when you right-click on the ActionList icon on the Form Designer.
1074461
1075462## The Debugger
1076463
1077464
1078465*Still to be written*.
1079466
1080467see also [:category: IDE Window - Debug](/wiki-category/IDE%20Window%20-%20Debug)
1081468
1082469## The Lazarus files
1083470
1084471`   (Thanks to Kevin Whitefoot.)`\
1085472`   (Additions by Giuseppe Ridinò, `User:Kirkpatc` and Tom Lisjac)`
1086473
1087474When you save you will actually be saving two files:
1088475
1089476`  xxx.pas and yyy.lpr `
1090477
1091478(You save more than that but those are the ones you get to name). The project file (lpr) and the unit file (pas) must not have the same name because Lazarus will helpfully rename the unit (inside the source code) to the same as the unit file name and the program to the name of the project file (it needs to do this or the compiler will probably not be able to find the unit later when referred to in the project file). Of course to be consistent it changes all the occurrences of unit1 to xxx.
1092479
1093480So if you are saving a project called **again**, trying to save again.pas and again.lpr fails because unit names and program names are in the same name space resulting in a duplicate name error.
1094481
1095482So here is what I ended up with:
1096483
1097484e:/lazarus/kj/lazhello:
1098485
1099486`total 4740  free 76500`\
1100487`-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe`\
1101488`-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi`\
1102489`-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr`\
1103490`-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm`\
1104491`-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs`\
1105492`-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas`\
1106493`-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu`\
1107494`-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat`
1108495
1109496Note that there are many more files than the two that I thought I was saving.
1110497
1111498Here is a brief note about each file:
1112499
1113500**again.exe:** The main program binary executable. Win32 adds an "exe" extension. Linux has none (just the name of the program). This file will be huge in Linux due to the inclusion of debugging symbols. Run the "strip" utility to remove them and substantially shrink the executable size.
1114501
1115502**again.lpi:** (Lazarus Project Information). This is the main information file of a Lazarus project; the equivalent Delphi main file of an application will be the .dpr file. It is stored in an XML format and contains instructions about all the libraries and units required to build the executable file.
1116503
1117504**again.lpr:** The main program source file or master file. Despite its lazarus specific extension it is in fact a perfectly normal Pascal source file. It has a uses clause that lets the compiler find all the units it needs. Note that the program statement does not have to name the program the same as the file name. This file is usually fairly small, with just a few statements to initialise, build the forms, run and close the application. Most of the work is done in the unit source files, with suffix '.pas'
1118505
1119506**againu.lfm:** This is where Lazarus stores the layout of the form unit, in human readable form. It reflects the properties of the various components, as set in the Object Inspector. Each object description starts with a line:
1120507
1121508`object xxxx `\
1122509`  then there follows a list of properties `\
1123510`  (including embedded or nested objects) then an `\
1124511`end `
1125512
1126513line. Lazarus uses this file to generate a resource file (.lrs) that is included in the initialisation section of the againu.pas unit. Delphi dfm files can be converted to lfm format in the Lazarus IDE using the Tools-\>Convert DFM file to LFM utility.
1127514
1128515**againu.lrs:** This is the generated resource file which contains the instructions to the program for building the form (if you look in the main Unit file, you will see in the initialization section the line
1129516
1130517`{$i againu.lrs} `
1131518
1132519which instructs the program to load the resource file). Note that it is not a Windows resource file.
1133520
1134521**againu.pas:** The unit that contains the code for the form; this is usually the only file that the application programmer needs to edit or inspect, and contains any code specifically supplied by the programmer (especially event handlers).
1135522
1136523**againu.ppu:** This is the compiled unit which gets linked into the executable file together with any other units named in the Uses section.
1137524
1138525**ppas.bat:** This is a simple script that links the program to produce the executable. If compilation is successfull, it is deleted by the compiler.
1139526
1140527------------------------------------------------------------------------
1141528
1142529[[Lazarus IDE Tools]]
1143530
1144531---
1145532*From the Free Pascal wiki, page "Lazarus Tutorial/hu", as it stood on 2021-12-08 after a change by Kupferstecher, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history