Difference between revisions of "Lazarus Tutorial/sk"

From Lazarus wiki
Jump to navigationJump to search
Line 96: Line 96:
  
  
====The View sub-menu====
+
====Menu View====
 +
Ovládanie zobrazenie rôznych okien a panelov na obrazovke.
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ViewMenuSnapshot.png </div>
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ViewMenuSnapshot.png </div>
Controls the display of various windows and panels on the screen.
+
* '''Object Inspector''': TOkno, zvyčajne umiestnené na ľavej strane obrazovky, ktoré zobrazuje funkcie formulára, ktorý je na obrazovke. Kliknutím mišou na ktorýkoľvek komponent formulára, spôsobí, že detaily komponentu budú zobrazené v Object Inspector. Na jeho vrchu je panel, ktorý zobrazuje stromovú štruktúru aktuálneho projektu a komponenty formulára môžu byť vybraté aj z tohoto panela. Základný panel má dve záložky, ktoré umožňujú zobraziť '''Properties''' alebo '''Events'''. Výber '''Properties''' zobrazí vlastnosti zvoleného komponentu v dvoch stĺpcoch, ľavý zobrazuje meno vlastnosti a pravý jej hodnotu. Výber '''Events''' zobrazí tiež dva stĺpce, ľavý s menom udalostí priradených ku komponentu a pravý ukazuje akciu, ktorá je výsledkom udalosti (procedúru udalosti). Ak nie je definovaná akcia, kliknutie na tlačítko <div class="box">...</div> spôsobí zobrazenie Editora zdrojového kódu s kurzorom umiestneným na prázdenj deklarácii procedúry, do ktorej môžete zadať svoj kód udalosti.
* '''Object Inspector''': The window that usually occupies the left side of the Desktop, and displays the features of the Form which is on the desktop. Clicking with the mouse on any component of the form will cause the details of that component to be displayed in the Object Inspector. There is a panel at the top which shows the tree-structure of the current project, and the components of the form may optionally be selected in this panel:  this will also cause the corresponding details to be displayed in the Object Inspector. The main lower panel has two tabs which allow selection of either '''Properties''' or '''Events''' to be displayed. Selection of '''Properties''' causes features such as name, colour, caption, font, size etc to be displayed:  there are two columns, the left showing the property, and the right showing the value associated with that property. Selection of '''Events''' displays two columns:  the left lists the possible events such as MouseClick or KeyDown associated with that component, and the right shows the action that results from that event. If there is no action defined, then clicking in the appropriate box or on the <div class="box">...</div> button causes the Source Editor to be displayed, with the cursor already positioned in a dummy Procedure declaration, waiting for event-defining code to be typed in.
+
* '''Source Editor''': Základné okno pre editovanie zdrojového kódu. Jeho správanie je veľmi podobné iným grafickým editorom textu, takže môžete myšou presúvať kurzor nad zobrazeným textom a stlačenie ľavého tlačítka myši počas posúvania vyberie a označí text. Pravým kliknutím zobrazíte kontextové menu, ale ak ste zvyknutý na editory Windows, Gnome alebo KDE, budete márne hľadať zvyčajné funkcie, ako Vystrihnúť, Kopírovať a Vložiť, ale zahŕňa voľby ako '''Find Declaration''' alebo '''Open File at Cursor'''Na vrchu okna Editora zdrojového kódu je niekoľko záložiek, reprezentujúcich otvorené súbory; kliknutie na jednu z nich vyvolá daný súbor do popredia, takto môžete jednoducho kopírovať zo súboru do súboru a vykonávať bežné editovacie funkcie. Editor zdrojového kódu poskytuje farebné zvýraznenie syntaxe kódu, s rôznymi farbami pre interpunkciu, komentáre, reťazcové konštanty atď. Rovnako zabezpečuje automatické odsadenie riadkov kódu. Funkcie a zhľad Editora zdrojového kódu sú nastaviteľné cez menu Environment -> Editor options a zvolením jednej z viacerých záložiek.
* '''Source Editor''': The main window in which source code is edited. Its behaviour is very like that of most other graphical text editors, so that the mouse can move the cursor over the displayed text, and clicking with the left mouse button while dragging the mouse will select and highlight text. Right clicking with the mouse displays a pop-up menu, but if you are familiar with Windows, Gnome or KDE editors, you will find that the pop-up menu DOES NOT include the usual Edit Cut, Copy or Paste functions, but does include options like Find Declaration or Open File at Cursor.  The top of the Source Editor window has a number of tabs, corresponding to the files that are open for the current project; clicking on any tab makes that file visible, and you can move easily from file to file, copying and pasting between files and performing most of the normal editing functions. The Source Editor performs colour syntax highlighting on the code, with different colours for punctuation marks, comments, string constants etc. It will also maintain the level of indentation from line to line as you type in code, until you change the indentation. The function and appearance of the Source Editor are very configurable from the Main Menu by selecting Environment -> Editor options and then selecting one of several tabs in the pop-up dialog box.
+
* '''Code Explorer''': Okno, zvyčajne umiestnené na pravej strane pracovnej plochy, ktoré v stromovej forme zobrazuje štruktúru kódu aktuálnej jednotky alebo programu. Ak zmeníte súbor zobrazený v okne Editora zdrojového kódu, musíte zvoliť tlačítko Refresh na zobrazenie novej štruktúry súboru. Okno po otvorení zvyčajne zobrazuje meno jednotky a vetvy pre časti Interface a Implementation, ale kliknutím na <div class="box">+</div> vľavo od vetvy otvoríte podvetvy a vetvičky :-), do úplných detailov samotných konštánt, typov apremenných, ako ja deklarácií procedúr a funkcií.
* '''Code Explorer''': A window usually placed on the right of the Desktop which displays, in tree form, the structure of the code in the current unit or program. It usually opens with just the Unit name and branches for Interface and Implementation sections, but clicking on the <div class="box">+</div> box to the left of any branch will open up its sub-branches or twigs, in more and more detail until individual constants, types and variables are displayed as well as procedure and function declarations.  If you change the file displayed in the main Source Editor window, you need to click on the Refresh button of the Code Explorer to display the structure of the new file.
+
* '''Units...''': pop-up dialóg so zoznamom súborov jednotiek aktuálneho projektu, ktorý umožní vybrať súbor Zobrazený v Editore zdrojového kódu. Zaškrtnutím voľby Multi select môžete vybrať a otvoriť viac jednotiek naraz, ale len jedna bude zobrazená. Táto položka menu je lepšia ako položka Project -> Project Inspector, ale zobrazuje len zoznam jednotiek a dovoľuje ich otvoriť.
* '''Units...''': Opens a pop-up dialog window with a list of the unit files in the current project.Clicking with the mouse on a filename selects that file; click on Open to display that file in the Source Editor.  Checking the Multi box allows several files to be selected simultaneously, and they will all be opened in the Source Editor (but only one at a time will be displayed). This Menu Option is rather like the Project -> Project Inspector option, but only displays the list of Unit files and allows them to be opened.
+
* '''Forms...''': pop-up dialóg so zoznamom formulárov aktuálneho projektu a umožní vybrať jeden alebo viac z nich pre zobrazenie.
* '''Forms...''': Opens a pop-up dialog window with a list of the Forms in the current project, and allows the selection of one or more of them for display.
+
* '''View Unit Dependencies''': pop-up dialóg, ktorý zobrazí stromovú štruktúru závislostí aktuálne otvorenej jednotky. Mnoho súborov zobrazených v tomto okne má svoje svoje vlastné <div class="box">+</div>, ktoré umožňujú preskúmať ich vlastné závislosti, často rekurzívnym spôsobom.
* '''View Unit Dependencies''': Opens a pop-up dialog window that shows, in a tree-like manner, the structure of dependencies of the currently open unit file. Most of the files listed as dependencies will have their own <div class="box">+</div> boxes, which allow the dependencies of the individual files to be explored, often in a highly recursive manner.
+
* '''View Unit Information''':
* '''Toggle form / unit view  F12''': Toggles whether the Source Editor or the current Form is placed on the top layer of the Desktop, and given focus.  If the Source Editor has focus, then you can edit the source code;  if the Form is given focus, you can manipulate the components on the desktop and edit the appearance of the Form. The easiest way to toggle the display between Editor and Form is to use the F12 key on the keyboard, but the same effect is achieved by selecting this option on the Main Menu.
+
* '''Toggle form / unit view  F12''': Prepína zobrazenie Formulár/Zdrojový kód formulára. Jednoduchším spôsobom je stlačenie F12 na klávesnici, ale táto položka menu má rovnaký význma.
* '''Messages''': A window that displays compiler messages, showing the progress of a successful compilation or listing the errors found.
+
* '''Messages''': Okno so správami prekladača, zobrazuje postup úspešného prekladu alebo vypisuje nájdené chyby.
* '''Search Results''': A window that displays the results of find in files.
+
* '''Search Results''': Okno s výsledkom hľadania textu v súboroch.
* '''Debug windows''': Opens a pop-up menu with several options for operating and configuring the Debugger. See below where the [[#The_Debugger|debugger]] is described.
+
* '''View Anchor editors''':
 +
* '''Debug windows''': pop-up menu s niekoľkými voľbami pre činnosť a konfiguráciu Debuggera. [[#The_Debugger|debugger]] je popísaný ďalej.
 
<div style="clear:both;"></div>
 
<div style="clear:both;"></div>
  
====The Project sub-menu====
+
====Menu Project====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ProjectMenuSnapshot.png </div>
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ProjectMenuSnapshot.png </div>
* '''New Project''': Create a new project.  A pop-up dialog window appears offering a choice of types of project to create.
+
* '''New Project''': Vytvorí nový projekt a poskytuje možnosť zvoliť typ projektu.
* '''New Project from file''': A Navigation dialog window appears, alowing selection of a file from which to create a new project.
+
* '''New Project from file''': Umožní vytvoriť nový projekt z existujúceho súboru.
* '''Open Project''' Open a project which has already been created and saved. A navigation dialog appears with a list of Lazarus Project Information (.lpi) files from which a project may be chosen.
+
* '''Open Project''': Otvorí projekt, ktorý už bol vytvorený a uložený. Dialóg ponúkne zoznam súborov Lazarus Project Information (.lpi), z ktorých si môžete vybrať.
* '''Open Recent Project''': Displays a pop-up list of recent projects on which you have been working, and allows selection of one of these.
+
* '''Open Recent Project''': Otvorí projekt zo zoznamu naposledy spracovávaných projektov.
* '''Save Project''': Similar to File -> Save:  all the files of the current project are saved; if they have not previously been saved, there is a prompt for filename(s)-  similar to Save Project As...
+
* '''Save Project''': Obdoba File -> Save:  uloží všetky súbory aktuálneho projektu; ak ešte neboli uložené, ponúkne dialóg na zadanie mena (ako Save Project As...).
* '''Save Project As...''': Prompts for filename to save project. A default filename of Project1.lpi is offered, but you should choose your own filename. Lazarus will not permit you to use the same name for the Project file and the Unit File (see [[Lazarus Tutorial#The_Lazarus_files| below]]).
+
* '''Save Project As...''': Požiada meno súboru pre uloženie projektu. Ponúkne prednastavené meno súboru Project1.lpi, ale môžete si zvoliť vlastné. Lazarus nedovoľuje použiť rovnaké meno súboru pre súbor projektu a súbor jednotky. Viz [[Lazarus Tutorial#The_Lazarus_files| nižšie]]).
* '''Publish Project''': Creates a copy of the whole project. If you want to send someone just the sources and compiler settings of your code, this function is your friend. A normal project directory contains a lot of information. Most of it is not needed to be published: the .lpi file contains session information (like caret position and bookmarks of closed units) and the project directory contains a lot of .ppu, .o files and the executable. To create a lpi file with only the base information and only the sources, along with all sub directories use "Publish Project". In the dialog you can setup the exclude and include filter, and with the command after you can compress the output into one archive. See [[Lazarus IDE Tools]]
+
* '''Publish Project''': Vytvorí kópiu celého projektu. Bežný adresár projektu obsahuje veľa informácií, ktoré nie je potrebné publikovať (informácie o session, súbory .ppu, .o, .exe. Publish Project vytvorí súbor .lpi obsahujúci len základné informácie a do kópie presunie len zdrojové kódy, zo všetkych podadresárov. V dialógu môžete nastaviť filter exclude/include a spôsob kompresie výstupného archívu. Viz [[Lazarus IDE Tools]]
* '''Project Inspector''': Opens a pop-up dialog with a tree-like display of the files in the current project. Allows you to add, remove or open selected files, or change options of the project.
+
* '''Project Inspector''': pop-up dialóg so stromovou štruktúrou súborov aktuálneho projektu. Dovoľuje pridať, odstrániť alebo otvoriť zvolené súbory alebo zmeniť vlastnosti projektu.
* '''Project Options...''': Opens a pop-up dialog window with tabs for setting options for Application (Title, Output Target file name), Forms (allowing you to select among the available forms, make them Auto-create) and Info (specifying whether editor information should be saved for closed files, or only for project files). '''I'M NOT REALLY VERY SURE WHAT IS THE SIGNIFICANCE OF THIS:  HELP!!'''
+
* '''Project Options...''': pop-up dialóg s voľbami nastavenia projektu (titulok, meno cieľového súboru), Forms (dovoľuje výber z dostupných formulárov, a ich nastavenie Auto-create) a Info (určuje, či editačné informácie majú byť uložené pre zatvárané súbory alebo len pre súbory projektu).
* '''Compiler options ...''': (Recently moved here from the Run Menu). Opens a multi-page tabbed window which allows configuration of the compiler.  Tabs include '''Paths''' which allows definition of search paths for units, include files, libraries etc as well as allowing choice of widget type for the forms (gtk, gnome, win32); '''Parsing''' which allows choice of rules for parsing source programs, '''Code''' which allows choice of optimisation for faster or smaller programs, choice of target processor, types of checks, heap size etc; '''Linking''' allowing choice of whether or how to use debugging, static or dynamic libraries, and whether to pass options through to the linker; '''Messages''' to define what type of messages should be generated during error conditions; '''Other''' which allows decision to use default configuration file (fpc.cfg) or some other file; '''Inherited''' which shows a tree structure diagram to indicate how options have been inherited from units already incorporated; '''Compilation''' which allows definition of commands to be executed before or after the compiler is launched and can allow use of Make files.  
+
* '''Compiler options ...''': Konfigurácia prekladača, zahŕňa záložky: '''Paths''' definícia ciest hľadania jednotiek, include súborov, knižníc... ako aj voľbu pomocného typu formulára (gtk, gnome, win32); '''Parsing''' voľba pravidiel pre syntaktickú analýzu programov, '''Code''' voľby optimalizácie pre rýchlejšie alebo pomalšieprogramy, výber cieľového procesora, veľkosti halsy atď; '''Linking''' voľby použitia ladenia, statických alebo dynamických knižníc atď; '''Messages''' typy správ, generované pri výskyte chyby; '''Other''' určenie predvoleného konfiguračného súboru (fpc.cfg) alebo iného súboru; '''Inherited''' stromový diagram ukazujúci voľby zdedené z už zahrnutých jednotiek; '''Compilation''' dovoľuje zadať príkazy vykonávané pred/po spustení prekladača a použitie súborov Make.
* '''Add editor file to Project''': Add the file currently being edited to the Project
+
* '''Add editor file to Project''': Do projektu pridá súbor, ktorý je práve upravovaný.
* '''Remove from Project''': Gives a pop-up menu of files available for removal from project.
+
* '''Remove from Project''': pop-up menu na odstránenie súboru z projektu.
* '''View Source''': No matter which file you are editing, takes you back to the main program file (.dpr)or the main .pas file if there is no .dpr.
+
* '''View Source''': Bez ohľadu na to, ktorý súbor je práve upravovaný, zobrazí základný programový súbor (.dpr) alebo základný súbor .pas, ak .dpr neexistuje.
* '''View ToDo List''':Opens a dialog box with a list of ToDo items associated with this project. This will list any ToDo comments in your project (lines commencing //TODO), and any others in the Lazarus units you have used. You need to Refresh the ToDo items in the dialog (using arrow symbol button of toolbar) before new 'ToDos' appear. The first column of the ToDo list contains numbers you have allocated to your ToDo comments; a simple //TODO comment will appear as a zero, but a comment of //TODO999 (for example) will place the number 999 in the first column.
+
* '''View ToDo List''': Otvorí dialóg so zoznamom položiek ToDo patriacich k projektu. Zobrazí zoznam všetkých komentárov ToDo vo vašom projekte (riadky začínajúce //TODO) a tiež všetky ostatné v jednotkách Lazarus, ktoré práve používate. Na to, aby sa objavili nové položky ToDo musíte použiť Refresh (pomocou tlačítka panela nástrojov). Prvý stĺpec zoznamu ToDo obsahuje číslo umiestnené vo vašom komentári ToDo; teda //TODO sa objaví ako 0, ale //TODO999 (napríklad) bude mať v prvom stĺpci číslo 999.
  
====The Run sub-menu====
+
====Menu Run====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/RunMenuSnapshot.png </div>
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/RunMenuSnapshot.png </div>
* '''Build''': Causes Lazarus to build (ie compile) any files in the project that have been changes since the last build.
+
* '''Build''': Preloží všetky súbory projektu, ktoré boli zmenené od posledného prekladu.
* '''Build all''': Builds all files in the project, whether or not there have been any changes.
+
* '''Build all''': Prekladá všetky súbory projektu, bez ohľadu na to, či boli alebo neboli zmenené.
* '''Abort build''': Stop the build process once it is running - either you have remembered that you did something silly and want to stop the build, or the system seems to be taking far too long and something is obviously wrong.
+
* '''Abort build''': Zastaví proces prekladu, ktorý je spustený - či už sa spamätáte, že máte niečo zle a chcete zastaviť preklad, alebo systém pracuje veľmi dlho a niečo je obvykle zle.
 
+
* '''Run''': Obvyklý spôsob spustenia prekladača a, ak je preklad úspešný, spustenia aplikácia. Lazarus uloží kópie súborov, potom spustí prekladač a linker, potom začne vykonávať finálny programový súbor (.exe).
* '''Run''': This is the usual way to  launch the compiler and, if compilation is successful, to start execution of the application. What actually happens is that Lazarus saves a copy of your files, then starts the compiler and linker, then begins execution of the final linked binary program.
+
* '''Pause''': Preruší vykonávanie aktuálne bežiaceho programu. Tým vám umožní skontrolovať akýkoľvek výstup, ktorý bol generovaný; vykonávanie môže pokračovať opätovným vybratím Run.
* '''Pause''': Suspend execution of the currently running program. This may allow you to inspect any output that has been generated; execution may be resumed by selecting '''Run''' again.
 
 
* '''Step into''': Used in conjunction with the debugger, causes execution of the program    one step at a time up to a bookmarked point in the source.
 
* '''Step into''': Used in conjunction with the debugger, causes execution of the program    one step at a time up to a bookmarked point in the source.
 
* '''Step over''': Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
 
* '''Step over''': Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
* '''Run to cursor''': Causes execution at normal speed (ie NOT one statement at a time) until the statement is reached where the cursor is located; then stops. Resume execution at normal speed by selecting '''Run'''.
+
* '''Run to cursor''': Spôsobí vykonávanie programu normálnou rýchlosťou (tj. nie jeden príkaz naraz) pokiaľ nedôjde po príkaz, na ktorom je umiestnený kurzor; potom zastaví. Pokračovanie vykonávania normálnou rýchlosťou dosiahnete zvolením '''Run'''.
* '''Stop''': Cease execution of the running program. Cannot be resumed by selecting '''Run''';  this will start the program again from the beginning (re-compiling if necessary).
+
* '''Stop''': Spôsobí zastavenie vykonávania bežiaceho programu. Nasledujúce zvolenie '''Run''' nepokračuje vo vykonávaní, ale spustí program od začiatku (ak treba i s prekladom).
 
+
* '''Run Parameters''': Otvorí viacstránkové pop-up okno, v ktorom môžete tadať voľby a parametre príkazového riadku pre spustenie programu; výber zobrazenia spusteného programu (tj. môžete použiť vzdialený X terminál terminal v Linuxe); môžete prepísať niektoré systémové premenné.
* '''Run Parameters''': Opens a multi-page pop-up window which allows command-line options and parameters to be passed to the program to be executed; allows selection of display to run program (eg a remote X terminal may be used in Linux); some system Environment variables may be overridden.
+
: Veľmi zaujímavou možnosťou tohoto sub-menu je aktivácia okna terminálu pre zobrazenie vstupu/výstupu konvenčnej konzoly Pascalu. Ak pracujete na konzolovom programe Pascalu, (tj. nepoužijete pre program GUI s formulármi, tlačítkami...), potom môžete zaškrtnúť políčko "Use launching application". Keď to nastavíte prvý krát a skúsite sekvenciu Compile/Run, asi dostanete divoké hlásenie hovoriace "xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied".
: One very important use of this sub-menu is to activate a terminal window in which conventional Pascal console input/output is displayed. If you are developing a console-mode Pascal program (ie one that doesn't use the Graphical User Interface with its forms, buttons and boxes) then you should check the box for "Use launching application". The first time you do this and try the Compile/Run sequence, you will probably get a rude message to say
+
: Ak toto nastane, potrebujete zmeniť povolenia príslušného súboru; možno to budete musieť urobiť ako root (administartor). Potomto, sa pri každom spustení programu objaví konzolové okno a všetky vaše textové vstupy/výstupy budú pracovať v ňom (readln, writeln ...).
"xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied".
+
: Po skončení práce vášho programu sa objaví na obrazovke správa "Press enter". Takto celý výstup generovaný vašim programom ostane na obrazovke, aby ste mali šancu prečítať si ho a okno bude zatvorené až po stlačení 'enter'.
: If this happens, you need to change the permissions on the appropriate file (for example using chmod +x ''filename'', or using the Windows utility for changing permissions); you might have to do this as root. After this, each time you launch you program, a console box will appear and all your text i/o (readln, writeln etc) will appear in it.
+
* '''Reset debugger''': Obnovuje debugger do jeho pôvodného stavu, všetky ladiace body a hodnoty premenných... sú zabudnuté.
: After your program has finished execution, a message "Press enter" appears on the screen. Thus any output your program generated will remain on the screen until you have had a chance to read it;  after you press 'enter' the console window closes.
+
* '''Build file''': Preloží súbor, ktorý je aktuálne otvorený v Editre zdrojového kódu.
: See the separate tutorial on [[Console Mode Pascal]] programming.
+
* '''Run file''': Preloží, spojí a spustí aktuálne otvorený súbor.  
* '''Reset debugger''': Restores the debugger to its original state, so that breakpoints and values of variables etc are forgotten.
+
* '''Configure Build + Run File''': Otvorí viacstránkové okno s voľbami, ktoré nastavia preklad práve tohoto súboru pri výbere '''Build Project''', dovolia výber pracovného adresára, použitie rôznych makier... Potom preloží a spustí súbor.
 
+
* '''Inspect ''':
* '''Build file''': Compile (build) just the file that is currently open in the Editor.
+
* '''Evaluate/Modify''':  
* '''Run file''': Compile, link and execute just the currently open file.
+
* '''Add watch''':
* '''Configure Build + Run File''': Opens a multi-page tabbed window with options to allow for build of just this file when '''Build Project''' is selected, allows selection of the working directory, the use of various Macros, etc. Then Builds and Runs the file.
+
* '''Add brak point''':  
 
 
'''NOTE: I AM NOT REALLY CLEAR IN WHAT CIRCUMSTANCES YOU WOULD USE THESE LAST THREE SELECTIONS;  IN PARTICULAR, WHAT HAPPENS TO OTHER FILES THAT ARE USED BY THE PROGRAM?''' [[User:Kirkpatc]]
 
 
<div style="clear:both;"></div>
 
<div style="clear:both;"></div>
  
 
====The Components sub-menu====
 
====The Components sub-menu====
* '''Open Package''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/OpenPackageSnapshot.png list of installed packages], with an invitation to [http://lazarus-ccr.sourceforge.net/kbdata/PackageContentsSnapshot.png open one or more of them], or to select various general or compiler options.
+
* '''Open Package''': Zobrazí [http://lazarus-ccr.sourceforge.net/kbdata/OpenPackageSnapshot.png zoznam nainštalovaných balíčkov], s možnosťou [http://lazarus-ccr.sourceforge.net/kbdata/PackageContentsSnapshot.png otvoriť jeden alebo viac z nich], alebo výber rôznych všeobecných volieb alebo volieb prekladača.
* '''Open Package File''': Open one of the files in the selected package.
+
* '''Open Package File''': Otvorí jeden zo súborov vo zvolenom balíčku.
* '''Open Recent Package''': Open a package that was opened recently.
+
* '''Open package of current unit''':
* '''Add Active Unit to Package''': Place the unit file (currently in the editor) into a package.
+
* '''Open Recent Package''': Ponúkne zoznam naposledy otvorených balíčkov.
* '''Package Graph''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/PackageGraphSnapshot.png graph] showing the relationships of the packages currently being used (if you aren't using any other packages, the Lazarus package and the FCL and LCL will be displayed).
+
* '''Add Active Unit to Package''': Pridá aktuálny súbor (otvorený v editore) do balíčka.
* '''Configure custom components''': If you have created some components, allows you to configure them.
+
* '''Package Graph''': Zobrazí [http://lazarus-ccr.sourceforge.net/kbdata/PackageGraphSnapshot.png graf vzťahov] jednotlivých balíčkov, ktoré sú používané (ak nepoužívate žiadny iný balíček, budú zobrazené balíčeky Lazarus, FCL a LCL).
 +
* '''Configure custom components''': táto položka už nie je...
  
 
====The Tools sub-menu====
 
====The Tools sub-menu====

Revision as of 21:56, 22 March 2005

This is the start of a Lazarus Tutorial. Please feel free to add your experiences to it.

Overview

Lazarus is a free and open source development tool for the FreePascal Compiler (object pascal), which is also free and open source. The Lazarus IDE (screenshot) is a stable and feature rich programming environment for creating self-standing graphical and console applications. It currently runs on Linux, FreeBSD and Win32 and provides a customizable source editor and visual form creation environment along with a package manager, debugger and complete GUI integration with the FreePascal Compiler.


Editor

Pri prvom spustení IDE Lazarus sa na vašej pracovnej ploche objaví niekoľko samostatných, nespojených alebo plávajúcich okien.

Prvé z nich, zobrazené pri hornom okraji pracovnej plochy má titulok Lazarus Editor vXXXXXX - project1. Toto je základné ovládacie okno vášho projektu a obsahuje Základné menu, paletu komponentov a panel nástrojov.

http://lazarus-ccr.sourceforge.net/kbdata/lazmain.jpg

V riadku pod titulkom je Základné menu (Main Menu) so zvyčajnými položkami pre funkcie File, Edit, Search, View atď, spolu s niektorými možnosťami, ktoré sú špecifické pre Lazarus. Nižšie je umiestnený Panel nástrojov s množinou BitButtonov, ktoré sprístupňujú niektoré voľby základného menu a vpravo od neho je Paleta komponentov (Component Palette).

Pod základným oknom IDE Lazarus sa ešte vľavo obajví okno Object Inspector a vedľa neho okno Editora zdrojového kódu (Lazarus Source Editor). Môže sa objaviť ešte jedno menšie okno, nazvané Form1, prekrývajúce Editor zdrojového kódu. Ak nie hneď viditeľné, môžete ho zbraziť stlačením klávesy F12, ktorá prepína medzi zobrazením Editora zdrojového kódu a zobrazením formulára. Okno formulára, je tým, na ktorom budete budovať grafické rozhranie svojej aplikácie, kým okno Editora kódu zobrazuje zdrojový kód Pascalu patriaci aplikácii, ktorú navrhujete. Práca s Object Inspectorom je detailnejšie rozobratá ďalej, pri popise Palety komponentov.

Keď začnete nový projekt (alebo ak prvý krát spustíte Lazarus) je vytvorený štandartný formulár, ktorý obsahuje bodkovanú mriežku, pomáhajúcu umiestniť rôzne komponenty formulára a titulkový pruh, ktorý obsahuje zvyčajné tlačítka pre minimalizovanie, maximalizovanie a zatvorenie okna. Ak kliknete myšou kdekoľvek do formulára, v Object Inspector, na ľavej strane pracovnej plochy, uvidíte vlastnosti formulára.

Počas práce môžu byť zobrazené i ďalšie okná, ako: the Project Inspector, ktorý obsahuje detaily o súboroch, ktoré sú súčasťou projektu a umožňuje prodať alebo odstrániť tieto súbory z/do projektu; alebo okno Messages, ktoré zobrazuje správy prekladača, chyby alebo hlásenia postupu vášho projektu; ak je Lazarus spustený z okna terminálu, pôvodný terminál necháva viditeľné a detailné správy prekladača sú zobrazované i tam.

Základné menu

(Main Menu)

Riadok základného menu obsahuje nasledujúce položky:

File Edit Search View Project Run Components Tools Environment Windows Help

Ako je zvykom, položky môžu bať vybraté umiestnením myši nad položku menu a kliknutím ľavým tlačítkom myši alebo stlačením Alt-F na klávesnici (základné okno musí mať fokus, ak ho nemá stláčajte opakovane TAB na prepínanie fokusu medzi oknami, kým nie je titulkový pruh cieľového okna zvýraznený farbou).


Menu File

  • New Unit: Vytvorí nový súbor jednotky (zdrojový kód Pascal).
  • New Form: Vytvorí nový formulár: vrátane pripojeného zdrojového súboru Pascal.
  • New ...: Poskytuje (pop-up menu box) s rôznymi typmi nových dokumentov.
  • Open: Otvorí dialóg pre otvorenie existujúceho súboru.
  • Revert: Ruší vykonané editácie a obnovuje súbor do pôvodného stavu.
  • Open Recent: Zoznam naposledy otvorených súborov.
  • Save: Uloží aktuálny súbor. Ak súbor ešte nemá meno, správa sa ako Save As.
  • Save As: Umožňuje vybrať adresár a meno pre uloženie aktuálneho súboru.
  • Save ALL:
  • Close: Zatvorí aktuálny súbor, spýtajúc sa na uloženie vykonaných úprav.
  • Close all editor files: Zatvorí všetky aktuálne otvorené súbory, spýtajúc sa na uloženie úprav.
  • Clean directory: Otvorí dialóg s nastaviteľnými filtrami, pre odstránenie súborov z aktuálneho adresára. Užitočné pre odstránenie súborov .bak a zvyškov projektov Delphi.
  • Restart:
  • Quit: Zatvorí Lazarus, spýtajúc sa na uloženie vykonaných úprav.


Menu Edit

  • Undo: Vrátenie poslednej editovanej akcie, ponechajúc Editor v stave tesne pred ňou.
  • Redo: Opakovanie poslednej akcie, ktorá bola vrátená pomocou Undo.
  • Cut: Vystrihne vybraný text a uiestni ho do schránky.
  • Copy: Prekopíruje vybratý text do schránky.
  • Paste: Vloží obsah schránky na pozíciu kurzora. Ak bol vybratý text, prepíše ho.
  • Indent selection: Posúva odsadenie vybratého textu doprava o rozsah zadaný v nastavení Environment -> Editor options -> General -> Block indent. Funkciaje užitočná pre formátovanie zdrojovéhokódu a vyvorenie blokovej štruktúry.
  • Unindent selection: Odstraňuje jednu úroveň odsadenia, posunúc text doľava o rozsah zadaný v nastavení Editora Block indent.
  • Enclose selection: Otvára pop-up menu s voľbami pre logické zakončenie vybratého textu (begin ... end; try ... except; try ... finally; repeat ... until; { ... } atď).
  • Uppercase selection: Konvertuje vybratý text na veľké písmená.
  • Lowercase selection: Konvertuje vybratý text na malé písmená.
  • Tabs to spaces in selection: Konveruje všetky tabulátory vybratého textu na medzery, podľa nastavenia Environment -> Editor options -> General -> Tab widths. Počet medzier nemá fixnú veľkosť, ale je to potrebný počet medzier na zaplnenie potrebnej šírky tabelátora medzerami.
  • Break lines in selection: Zalomí riadok vybratého textu, ktorý presahuje 80 znakov alebo počet zadaný v nastavení Environment -> Editor options -> Display -> Right Margin, riadok je zalomený na hranici slova a pokračuje na nasledujúcom riadku.
  • Comment selection: Vloží značky komentára // na každý riadok vybratého textu.
  • Uncomment selection: Odstráni značky komentára.
  • Insert $IfDef:
  • Sort selection: Zoradí riadky (alebo slová v odstavci) podľa abecedy; voľby pre smer radenia, citlivosť na veľkosť písmen. Uprostred zrojového kódu, samozrejme, to neprichádza do úvahy, ale ak máte zoznam, ktorý treba zoradiť, oceníte tento trik.
  • Select: Umožní výber blokov textu. Voľby zahŕňajú Vybrať všetko, vybrať po brace, vybrať odstavec alebo riadok, atď.
  • Insert from character map: Umožní vloženie symbolu, ktorý nie je na klávesnici, vybratý z pop-up mapy znakov.
  • Insert text: Zobrazí pop-up menu pre vloženie štandartných textov, ako kľúčové slová CVS (Author, Date, Header atď), či poznámku GPL, meno užívateľa, dátum a čas.
  • Complete code: Dokončí kód pod kurzorom. Závisí od kontextu a šetrí mnoho času. Napríklad dokončuje triedy, pridaním súkromných premenných, prístupové metódy Get a Set vlastností a pridaním tela metód. Na priradeniach premenných (tj. i:=3;) pridáva deklaráciu premennej. Pri forward deklarovaných procedúrach pridáva telá procedúr. Pri priradení udalostí (OnClick:=) pridáva definíciu a telo metódy. Viď Lazarus IDE Tools.
  • Extract procedure: Použije vybratý text (príkaz alebo sériu príkazov) na vytvorenie novej procedúry.

Menu Search

  • Find: Obdoba vlastnosti skoro všetkých grafických editorov: pop-up dialógový box pre zadanie hľadaného textu a volieb hľadania, ako citlivosť na veľkosť písmen, celé slová, začiatok, oblasť a smer hľadania.
  • Find Next, Find previous: Pokračuje v hľadaní predtým zvoleného textu, zadaným smerom.
  • Find in files: Hľadá textový reťazec v súboroch: pop-up dialód s voľbami všetky otvorené súbory, všetky súbory v projekte alebo všetky adresáre; umžňuje i zadanie masky pr výber typu súboru.
  • Replace: Podobné ako Find; zobrazí pop-up dialóg s miestom pre zadanie hľadaného reťazca a nahradzujúceho textu a volieb pre citlivosť na veľkosť písmen, smer atď.
  • Incremental find: Hľadanie reťazca kým zadávate hľadaný reťazec. Príklad: stlačíte "l" a je zvýraznené prvé "l", ak potom stlačíte "a", editor nájde nasledujúce "la" atď.
  • Goto line: Presunie kurzor na zadaný riadok súboru.
  • Jump back: Presunie kurzor späť k nasledujúcej záložke (musíte použiť Add jump point to history). Presúva i na záložky iných súborov otvorených v Editore.
  • Jump forward: Presunie kurzor vpred na nasledujúcu záložku.
  • Add jump point to history: Pridá do súboru záložky alebo skokové body.
  • View Jump-History: Ukáže zoznam záložiek v súbore: Zatiaľ neimplementované???.
  • Jump to next error:
  • Jump to previous error:
  • Find other end of code block: Ak je kurzor umiestnený na begin, presunie kurzor na príslušný end a naopak.
  • Find code block start: Presunie kurzor na begin procedúry alebo funkcie, v tele ktorej je umiestnený.
  • Find Declaration at cursor: Presunie kurzor na miesto deklarácie zvoleného identifikátora. Môže to byť v rovnakom súbore alebo v inom. Ak nie je otvorený, otvorí ho v Editore (tak ak je procedúra alebo funkcia deklarovaná napr. v classesh.inc , tento bude otvorený v Editore).
  • Open filename at cursor: Otovorí súbor, ktorého meno je vybraté kurzorom. Užitočné na zobrazenie Include súborov alebo súborov obsahujúcich iné Jednotky použité v projekte.
  • Goto include directive: Ak je kurzor umiestnený v súbore, ktorý je Included v inom súbore, presunie kurzor na miesto v súbore, odkiaľ bol volaný súbor Include.


Menu View

Ovládanie zobrazenie rôznych okien a panelov na obrazovke.

  • Object Inspector: TOkno, zvyčajne umiestnené na ľavej strane obrazovky, ktoré zobrazuje funkcie formulára, ktorý je na obrazovke. Kliknutím mišou na ktorýkoľvek komponent formulára, spôsobí, že detaily komponentu budú zobrazené v Object Inspector. Na jeho vrchu je panel, ktorý zobrazuje stromovú štruktúru aktuálneho projektu a komponenty formulára môžu byť vybraté aj z tohoto panela. Základný panel má dve záložky, ktoré umožňujú zobraziť Properties alebo Events. Výber Properties zobrazí vlastnosti zvoleného komponentu v dvoch stĺpcoch, ľavý zobrazuje meno vlastnosti a pravý jej hodnotu. Výber Events zobrazí tiež dva stĺpce, ľavý s menom udalostí priradených ku komponentu a pravý ukazuje akciu, ktorá je výsledkom udalosti (procedúru udalosti). Ak nie je definovaná akcia, kliknutie na tlačítko
    ...
    spôsobí zobrazenie Editora zdrojového kódu s kurzorom umiestneným na prázdenj deklarácii procedúry, do ktorej môžete zadať svoj kód udalosti.
  • Source Editor: Základné okno pre editovanie zdrojového kódu. Jeho správanie je veľmi podobné iným grafickým editorom textu, takže môžete myšou presúvať kurzor nad zobrazeným textom a stlačenie ľavého tlačítka myši počas posúvania vyberie a označí text. Pravým kliknutím zobrazíte kontextové menu, ale ak ste zvyknutý na editory Windows, Gnome alebo KDE, budete márne hľadať zvyčajné funkcie, ako Vystrihnúť, Kopírovať a Vložiť, ale zahŕňa voľby ako Find Declaration alebo Open File at Cursor. Na vrchu okna Editora zdrojového kódu je niekoľko záložiek, reprezentujúcich otvorené súbory; kliknutie na jednu z nich vyvolá daný súbor do popredia, takto môžete jednoducho kopírovať zo súboru do súboru a vykonávať bežné editovacie funkcie. Editor zdrojového kódu poskytuje farebné zvýraznenie syntaxe kódu, s rôznymi farbami pre interpunkciu, komentáre, reťazcové konštanty atď. Rovnako zabezpečuje automatické odsadenie riadkov kódu. Funkcie a zhľad Editora zdrojového kódu sú nastaviteľné cez menu Environment -> Editor options a zvolením jednej z viacerých záložiek.
  • Code Explorer: Okno, zvyčajne umiestnené na pravej strane pracovnej plochy, ktoré v stromovej forme zobrazuje štruktúru kódu aktuálnej jednotky alebo programu. Ak zmeníte súbor zobrazený v okne Editora zdrojového kódu, musíte zvoliť tlačítko Refresh na zobrazenie novej štruktúry súboru. Okno po otvorení zvyčajne zobrazuje meno jednotky a vetvy pre časti Interface a Implementation, ale kliknutím na
    +
    vľavo od vetvy otvoríte podvetvy a vetvičky :-), do úplných detailov samotných konštánt, typov apremenných, ako ja deklarácií procedúr a funkcií.
  • Units...: pop-up dialóg so zoznamom súborov jednotiek aktuálneho projektu, ktorý umožní vybrať súbor Zobrazený v Editore zdrojového kódu. Zaškrtnutím voľby Multi select môžete vybrať a otvoriť viac jednotiek naraz, ale len jedna bude zobrazená. Táto položka menu je lepšia ako položka Project -> Project Inspector, ale zobrazuje len zoznam jednotiek a dovoľuje ich otvoriť.
  • Forms...: pop-up dialóg so zoznamom formulárov aktuálneho projektu a umožní vybrať jeden alebo viac z nich pre zobrazenie.
  • View Unit Dependencies: pop-up dialóg, ktorý zobrazí stromovú štruktúru závislostí aktuálne otvorenej jednotky. Mnoho súborov zobrazených v tomto okne má svoje svoje vlastné
    +
    , ktoré umožňujú preskúmať ich vlastné závislosti, často rekurzívnym spôsobom.
  • View Unit Information:
  • Toggle form / unit view F12: Prepína zobrazenie Formulár/Zdrojový kód formulára. Jednoduchším spôsobom je stlačenie F12 na klávesnici, ale táto položka menu má rovnaký význma.
  • Messages: Okno so správami prekladača, zobrazuje postup úspešného prekladu alebo vypisuje nájdené chyby.
  • Search Results: Okno s výsledkom hľadania textu v súboroch.
  • View Anchor editors:
  • Debug windows: pop-up menu s niekoľkými voľbami pre činnosť a konfiguráciu Debuggera. debugger je popísaný ďalej.

Menu Project

  • New Project: Vytvorí nový projekt a poskytuje možnosť zvoliť typ projektu.
  • New Project from file: Umožní vytvoriť nový projekt z existujúceho súboru.
  • Open Project: Otvorí projekt, ktorý už bol vytvorený a uložený. Dialóg ponúkne zoznam súborov Lazarus Project Information (.lpi), z ktorých si môžete vybrať.
  • Open Recent Project: Otvorí projekt zo zoznamu naposledy spracovávaných projektov.
  • Save Project: Obdoba File -> Save: uloží všetky súbory aktuálneho projektu; ak ešte neboli uložené, ponúkne dialóg na zadanie mena (ako Save Project As...).
  • Save Project As...: Požiada meno súboru pre uloženie projektu. Ponúkne prednastavené meno súboru Project1.lpi, ale môžete si zvoliť vlastné. Lazarus nedovoľuje použiť rovnaké meno súboru pre súbor projektu a súbor jednotky. Viz nižšie).
  • Publish Project: Vytvorí kópiu celého projektu. Bežný adresár projektu obsahuje veľa informácií, ktoré nie je potrebné publikovať (informácie o session, súbory .ppu, .o, .exe. Publish Project vytvorí súbor .lpi obsahujúci len základné informácie a do kópie presunie len zdrojové kódy, zo všetkych podadresárov. V dialógu môžete nastaviť filter exclude/include a spôsob kompresie výstupného archívu. Viz Lazarus IDE Tools
  • Project Inspector: pop-up dialóg so stromovou štruktúrou súborov aktuálneho projektu. Dovoľuje pridať, odstrániť alebo otvoriť zvolené súbory alebo zmeniť vlastnosti projektu.
  • Project Options...: pop-up dialóg s voľbami nastavenia projektu (titulok, meno cieľového súboru), Forms (dovoľuje výber z dostupných formulárov, a ich nastavenie Auto-create) a Info (určuje, či editačné informácie majú byť uložené pre zatvárané súbory alebo len pre súbory projektu).
  • Compiler options ...: Konfigurácia prekladača, zahŕňa záložky: Paths definícia ciest hľadania jednotiek, include súborov, knižníc... ako aj voľbu pomocného typu formulára (gtk, gnome, win32); Parsing voľba pravidiel pre syntaktickú analýzu programov, Code voľby optimalizácie pre rýchlejšie alebo pomalšieprogramy, výber cieľového procesora, veľkosti halsy atď; Linking voľby použitia ladenia, statických alebo dynamických knižníc atď; Messages typy správ, generované pri výskyte chyby; Other určenie predvoleného konfiguračného súboru (fpc.cfg) alebo iného súboru; Inherited stromový diagram ukazujúci voľby zdedené z už zahrnutých jednotiek; Compilation dovoľuje zadať príkazy vykonávané pred/po spustení prekladača a použitie súborov Make.
  • Add editor file to Project: Do projektu pridá súbor, ktorý je práve upravovaný.
  • Remove from Project: pop-up menu na odstránenie súboru z projektu.
  • View Source: Bez ohľadu na to, ktorý súbor je práve upravovaný, zobrazí základný programový súbor (.dpr) alebo základný súbor .pas, ak .dpr neexistuje.
  • View ToDo List: Otvorí dialóg so zoznamom položiek ToDo patriacich k projektu. Zobrazí zoznam všetkých komentárov ToDo vo vašom projekte (riadky začínajúce //TODO) a tiež všetky ostatné v jednotkách Lazarus, ktoré práve používate. Na to, aby sa objavili nové položky ToDo musíte použiť Refresh (pomocou tlačítka panela nástrojov). Prvý stĺpec zoznamu ToDo obsahuje číslo umiestnené vo vašom komentári ToDo; teda //TODO sa objaví ako 0, ale //TODO999 (napríklad) bude mať v prvom stĺpci číslo 999.

Menu Run

  • Build: Preloží všetky súbory projektu, ktoré boli zmenené od posledného prekladu.
  • Build all: Prekladá všetky súbory projektu, bez ohľadu na to, či boli alebo neboli zmenené.
  • Abort build: Zastaví proces prekladu, ktorý je spustený - či už sa spamätáte, že máte niečo zle a chcete zastaviť preklad, alebo systém pracuje veľmi dlho a niečo je obvykle zle.
  • Run: Obvyklý spôsob spustenia prekladača a, ak je preklad úspešný, spustenia aplikácia. Lazarus uloží kópie súborov, potom spustí prekladač a linker, potom začne vykonávať finálny programový súbor (.exe).
  • Pause: Preruší vykonávanie aktuálne bežiaceho programu. Tým vám umožní skontrolovať akýkoľvek výstup, ktorý bol generovaný; vykonávanie môže pokračovať opätovným vybratím Run.
  • Step into: Used in conjunction with the debugger, causes execution of the program one step at a time up to a bookmarked point in the source.
  • Step over: Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
  • Run to cursor: Spôsobí vykonávanie programu normálnou rýchlosťou (tj. nie jeden príkaz naraz) pokiaľ nedôjde po príkaz, na ktorom je umiestnený kurzor; potom zastaví. Pokračovanie vykonávania normálnou rýchlosťou dosiahnete zvolením Run.
  • Stop: Spôsobí zastavenie vykonávania bežiaceho programu. Nasledujúce zvolenie Run nepokračuje vo vykonávaní, ale spustí program od začiatku (ak treba i s prekladom).
  • Run Parameters: Otvorí viacstránkové pop-up okno, v ktorom môžete tadať voľby a parametre príkazového riadku pre spustenie programu; výber zobrazenia spusteného programu (tj. môžete použiť vzdialený X terminál terminal v Linuxe); môžete prepísať niektoré systémové premenné.
Veľmi zaujímavou možnosťou tohoto sub-menu je aktivácia okna terminálu pre zobrazenie vstupu/výstupu konvenčnej konzoly Pascalu. Ak pracujete na konzolovom programe Pascalu, (tj. nepoužijete pre program GUI s formulármi, tlačítkami...), potom môžete zaškrtnúť políčko "Use launching application". Keď to nastavíte prvý krát a skúsite sekvenciu Compile/Run, asi dostanete divoké hlásenie hovoriace "xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied".
Ak toto nastane, potrebujete zmeniť povolenia príslušného súboru; možno to budete musieť urobiť ako root (administartor). Potomto, sa pri každom spustení programu objaví konzolové okno a všetky vaše textové vstupy/výstupy budú pracovať v ňom (readln, writeln ...).
Po skončení práce vášho programu sa objaví na obrazovke správa "Press enter". Takto celý výstup generovaný vašim programom ostane na obrazovke, aby ste mali šancu prečítať si ho a okno bude zatvorené až po stlačení 'enter'.
  • Reset debugger: Obnovuje debugger do jeho pôvodného stavu, všetky ladiace body a hodnoty premenných... sú zabudnuté.
  • Build file: Preloží súbor, ktorý je aktuálne otvorený v Editre zdrojového kódu.
  • Run file: Preloží, spojí a spustí aktuálne otvorený súbor.
  • Configure Build + Run File: Otvorí viacstránkové okno s voľbami, ktoré nastavia preklad práve tohoto súboru pri výbere Build Project, dovolia výber pracovného adresára, použitie rôznych makier... Potom preloží a spustí súbor.
  • Inspect :
  • Evaluate/Modify:
  • Add watch:
  • Add brak point:

The Components sub-menu

  • Open Package: Zobrazí zoznam nainštalovaných balíčkov, s možnosťou otvoriť jeden alebo viac z nich, alebo výber rôznych všeobecných volieb alebo volieb prekladača.
  • Open Package File: Otvorí jeden zo súborov vo zvolenom balíčku.
  • Open package of current unit:
  • Open Recent Package: Ponúkne zoznam naposledy otvorených balíčkov.
  • Add Active Unit to Package: Pridá aktuálny súbor (otvorený v editore) do balíčka.
  • Package Graph: Zobrazí graf vzťahov jednotlivých balíčkov, ktoré sú používané (ak nepoužívate žiadny iný balíček, budú zobrazené balíčeky Lazarus, FCL a LCL).
  • Configure custom components: táto položka už nie je...

The Tools sub-menu

  • Configure custom tools: Allows the user to add various external tools (usually macros) to the toolkit
  • Quick syntax check: Perform a quick check of the syntax in your source file without actually compiling anything. Essential step in developing long or complicated programs, where you don't want to waste time compiling if the code is wrong.
  • Guess unclosed block: useful utility if you have a complex nested block structure and you have left out an 'end' somewhere
  • guess misplaced IFDEF/ENDIF: useful if there is a complex or nested macro structure and you think you have left out an ENDIF directive
  • Make resource string: I NEED SOME HELP IN DESCRIBING THE FUNCTION OF THIS SELECTION: I HAVE NEVER USED IT MYSELF AND DON'T REALLY KNOW WHAT IT DOES. User:Kirkpatc
  • Diff: Allows comparison between two files (or, usually, two versions of the same file) to find differences. Options to ignore white space at beginning or end of lines or differences in line termination: CR+LF versus LF). Useful for checking if there have been changes since last CVS update etc.
  • Check LFM file in editor: Allows inspection of the LFM file which contains the settings that describe the current form
  • Convert Delphi unit to Lazarus unit: Helps in porting Delphi applications to Lazarus; makes the necessary changes to the source file. See Lazarus For Delphi Users and Code Conversion Guide.
  • Convert DFM file to LFM: For porting from Delphi to Lazarus: converts the Form Description files from Delphi to Lazarus. See Lazarus For Delphi Users and Code Conversion Guide.
  • Build Lazarus: Launches a re-build of Lazarus from the most recently downloaded or updated CVS files. Hit the button and sit back to watch it happen! (track the process on your Messages window).
  • Configure "Build Lazarus": Allows the user to determine which parts of Lazarus should be re-built, and how. For example, you could select to have just the LCL re-built, or to have everything except the examples built; you can select which LCL interface to use (ie which set of widgets), and you can select the target operating system and specify a different target directory.

The Environment sub-menu

  • Environment options: Displays a multi-page window with tabs for
    • Files - allowing the user to specify path to default directory, compiler, source directory and temporary directory for compilation;
    • Desktop - options for Language, Auto save behaviour, saving desktop properties, hints for component palette and speed buttons;
    • Windows, to allow specification of size and behaviour of the various windows;
    • Form Editor - choose colours for editing forms;
    • Object Inspector - choose colour and height of items;
    • Backup - specify how to backup files when editing;
    • Naming - specify what extension to use in naming pascal files ('.pp' or '.pas'), whether to save files with names in lowercase, whether to perform auto-delete or auto-rename.
  • Editor options: Multi-page window, with tabs for
    • General - determines behaviour like auto-indent, bracket highlighting, drag-drop editing, scrolling, syntax highlighting, showing hints, size of block indent and tabs, limit of Undo;
    • Display - options for showing line numbers, presence of gutters, size and type of font for editor, and contains a preview panel showing the colours of the various syntax features such as comments, directives, punctuation, errors and breakpoints;
    • Key Mappings - options to select Lazarus or Turbo Pascal scheme;
    • Color - allows choice of colour scheme for text features, for a number of language types such as Object Pascal, C++, Perl, HTML, XML and shell scripts. It shows preview panel again (for whichever language is selected);
    • Code Tools - allows selection of features like Identifier Completion, tooltips, specification of template file names, specific templates for code completion.
  • Debugger Options: Multi-page window with tabs for
    • General - choose debugger: none, GNU debugger (gdb) or gdb through SSH, specify search paths for debuggers,and specific options for chosen debugger;
    • Event log - specify whether to clear log on run, and which messages to display;
    • Language Exceptions - select which exceptions can be ignored;
    • OS Exceptions - allows user to add certain signals which apply to current operating system.
  • Code Tool Options: Multi-page window, tabs for
    • General - Allows entry of additional source search paths, specify Jumping Method;
    • Code Creation - determines whether created code is added before or after certain features;
    • Words - determines whether Pascal keywords are to be entered in upper or lower case, or as Capitalised Words;
    • Line Splitting - establish rules about where lines are allowed to be split (before or after punctuation, after keywords etc);
    • Space - decide whether a space is to be added automatically before or after certain syntactic features such as keywords or punctuation marks.
  • Code Tools Defines Editor: I NEED SOME HELP IN DESCRIBING THIS, AS I HAVEN'T A CLUE WHAT THIS ITEM IS FOR! User:Kirkpatc


  • Re-scan FPC Source directory Looks through the directory again. Lazarus uses the fpc sources to generate correct event handlers and while looking for declarations. If somebody changes the directory in the environment options, then this directory is rescanned, to make sure lazarus uses the version stored in that location. But if this directory has changed without lazarus noticing, then you may get some errors when designing forms or doing "Find declaration". If you get such an error, you can do two things:
    1. Check the fpc source directory setting in the environment option.
    2. Re-scan FPC source directory.

The Windows sub-menu

Contains a list of the currently opened files and the available windows such as Source Editor, Object Inspector and Project Inspector. Clicking on the name of one of the windows brings it to the foreground and gives it focus.

The Help sub-menu

At present this has three selections:

  • Online Help which at present opens a browser window that contains a picture of the running cheetah and a few links to the Lazarus, FreePascal and WiKi websites
  • Configure Help which opens a pop-up menu with options to select viewers and databases from which to read Help information. This option allows the user to specify either the on-line documents section of the Lazarus-CCR website, some other website containing the documents, or a local store for the documentation (this would eventually become the default, when the Help system is fully developed).

At present by default, if you place your Editor cursor over any keyword from the FreePascal Components Library FCL or the RunTime Library RTL (but not the Lazarus Components Library LCL) and then press <<F1>> you will be taken to the appropriate definition on the website. THIS SECTION STILL REPRESENTS WORK IN PROGRESS

  • About Lazarus Displays a pop-up box with some information about Lazarus.

Eventually there will be a full on-line Help service, with information about Pascal syntax, the use of the IDE, how to use, modify or create Components, and hints on how to perform certain tasks. This part of the Documentation section (the thing you are currently reading) represents the beginning of the process. We need contributions from anyone who feels able to provide them: the WiKi is very easy to edit.

The Button bar

A 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:

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).

The Component Palette

A Tabbed toolbar which displays a large number of icons representing commonly used components for building Forms.

Each 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.

If 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 section of the interface part of the Unit (usually as part of the overall TForm1), and an instance of that class is added to the var section (usually as the variable Form1). Any Methods that you design to be used by the Form or its Components (ie Procedures or Functions) will be placed in the implementation part of the Unit

In 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.

TABS (the names are largely self-explanatory):

  • Standard: Frequently used components: TMainMenu, TPopupMenu, TButton, TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox, TStaticText, TRadioGroup, TCheckGroup, TPanel, TActionList
  • Additional: More, often-used components: TBitBtn, TSpeedButton, TImage, TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, TMaskEdit, TCheckListBox, TScrollBox, TApplicationProperties, TStringGrid, TDrawGrid, TPairSplitter
  • Common Controls: TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
  • Dialogs: TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog

Several useful Dialog procedures or functions don't appear on the Palette, but are easily used as direct calls from your source program.

For 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.

Some 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.

ry 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!

  • Misc: TColorButton, TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox
  • Data Controls: Data-aware components, which largely replicate the Standard and Additional groups but are applicable to Databases: TDBNavigation, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
  • Data Access: TDatasource
  • System: TTimer, TIdleTimer, TProcess
  • SynEdit: 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. TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynMultiSyn

To 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.

If 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.

The Debugger

Still to be written.

The Lazarus files

   (Thanks to Kevin Whitefoot.)
   (Additions by Giuseppe Ridinò, User:Kirkpatc and Tom Lisjac)

When you save you will actually be saving two files:

  xxx.pas and yyy.lpr 

(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.

So 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.

So here is what I ended up with:

e:/lazarus/kj/lazhello:

total 4740  free 76500
-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe
-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi
-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr
-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm
-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs
-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas
-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu
-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat

Note that there are many more files than the two that I thought I was saving.

Here is a brief note about each file:

again.exe: The main program binary executable. Win32 adds an "exe" extension. Linux has none. This file will be huge on Linux due to the inclusion of debugging symbols. Run the "strip" utility to remove them and substantially shrink the executable size.

again.lpi: This is the main file of a Lazarus project (Lazarus Project Information); the equivalent Delphi main file of an application will be the .dpr file. It is stored in an XML format.

again.lpr: The main program source 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.

againu.lfm: This is where Lazarus stores the layout of the form unit. Lazarus uses this to generate a resource file 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.

again.lrs: This is the generated resource file. Note that it is not a Windows resource file.

againu.pas: The unit that contains the code for the form.

again.ppu: This is the compiled unit.

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.

Original contributors and changes

This page has been imported from the epikwiki version.

  • Created initial page and template. T. Lisjac - 11/04/2003 VlxAdmin
  • Inserted a note containing instructions for writing your first Lazarus Program. Suggest an administrator places it in the appropriate place on the Tutorial menu. 3/09/2004 User:Kirkpatc
  • Per above, moved Chris's writeup to the main body of the tutorial VlxAdmin
  • Began to insert text describing the Lazarus Editor - more to follow! 24 Mar 2004 User:Kirkpatc
  • Added some more to Lazarus Editor section of Tutorial. 25 Mar 2004 User:Kirkpatc
  • Added screenshots and revised some of the page formatting VlxAdmin 3/25/2004
  • Moved some of kwhitefoot's comments into Tutorial section. Formatting not quite right, but have to go to bed now! 26 Mar 2004 User:Kirkpatc
  • Formatted, added credits and comments. Removed original notes. VlxAdmin 3/26/2004
  • More material added to Editor section of tutorial. 26 Mar 2004 User:Kirkpatc
  • More material added describing the Main Menu. Renamed 'Hello World' to 'Getting Started' and moved it to nearer the top. 31 March 2004 User:Kirkpatc
  • Inserted section on Run sub-menu. Some general editing (eg ended each entry with a period to ensure consistency). 9 Apr 2004 User:Kirkpatc
  • Inserted a new section on How to get started with MySQL in FPC/Lazarus. 13 Apr 2004 User:Kirkpatc
  • Deleted the section on MySQL from here: it has been copied to Lazarus Database section of tutorial. 14 Apr 2004 User:Kirkpatc
  • Added some more to the description of the Editor Main Menu. 18 Apr 2004 User:Kirkpatc
  • Added section on Environment sub-menu. 19 Apr 2004 User:Kirkpatc
  • Added section on Components sub-menu. 4 May 2004 User:Kirkpatc
  • Adding Tools sub-menu description (incomplete). 7 May 2004 User:Kirkpatc
  • Added some screenshots to Menu descriptions. 9 May 2004 User:Kirkpatc
  • Fixed a bit in Environment Options - thanks VincentSnijders. 14 May 2004 User:Kirkpatc
  • More additions to Tools sub-menu. 19 May 2004 User:Kirkpatc
  • Added a section on the Button Bar and started work on The Component Palette. 20 May 2004 User:Kirkpatc
  • Posted a description file for the StdCtrls unit of the LCL, in the hope that people will add comments. 26 May 2004 User:Kirkpatc
  • Edited the StdCtrls file, removing a lot of repetitive material and doing some formatting. It is still far too long. 28 May 2004 User:Kirkpatc
  • Expanding on the Components Palette. 5 June 2004 User:Kirkpatc
  • Added a lot to the DialogExamples page. 10 June 2004 User:Kirkpatc
  • Considerable revision of the StdCtrls page, hopefully making it clearer and encouraging people to contribute - particularly in the 'Description' sections. 14 June 2004 User:Kirkpatc
  • Added pages for Menus and Dialogs units (linked to Component Palette description) - please feel free to add to these pages. 14 June 2004 User:Kirkpatc
  • Added page for Common Controls (linked to Component Palette). 16 June 2004 User:Kirkpatc
  • Added MaskEdit page (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Added Buttons, ExtCtrls pages (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Edited MainMenu component description page. 23 June 2004 User:Kirkpatc
  • Some additions to Common Controls. 28 June 2004 User:Kirkpatc
  • A new tutorial on Text-mode Pascal programming has been added. 5 July 2004 User:Kirkpatc
  • Minor changes to ComCtrls, ExtCtrls, Environment Menu. 10 July User:Kirkpatc
  • Added FormsTxt, component description page for Component Palette. 20 July 2004 User:Kirkpatc
  • Some corrections to ConsoleModePascal. 21 July 2004 User:Kirkpatc
  • Some small changes to ComponentPalette. 22 July 2004 User:Kirkpatc