Difference between revisions of "Lazarus Tutorial/fr"

From Free Pascal wiki
Jump to navigationJump to search
(Traduction →‎L'Editeur)
(→‎Menu principal: Content moved to new Main menu/fr page)
 
(206 intermediate revisions by 17 users not shown)
Line 1: Line 1:
 
{{Lazarus Tutorial}}
 
{{Lazarus Tutorial}}
  
''This is the start of a Lazarus Tutorial. Please feel free to add your experiences to it.''
+
''Ceci est le début du Tutoriel Lazarus. N'hésitez pas à y ajouter vos expériences.''
 
==Vue d'ensemble==
 
==Vue d'ensemble==
Lazarus est un outil de développement libre et open source dédié au compilateur FreePascal (Pascal objet). FreePascal est également libre et open source. L'Environnement de Développement Intégré (EDI) Lazarus ([http://lazarus-ccr.sourceforge.net/kbdata/lazide.jpg capture d'écran en Anglais]) est stable, a de nombreuses fonctionnalités pour créer des logiciel pouvant s'exécuter de façon autonome. Il fonctionne actuellement sous Linux, FreeBSD et Win32, fournit un éditeur de code source extensible, un environnement visuel de création de formulaire, un gestionnaire de package, un debugger et une interface graphique utilisateur (GUI) intégrée au compilateur FreePascal.
+
Lazarus est un outil de développement libre et open source dédié au compilateur FreePascal (Pascal objet). FreePascal est également libre et open source. L'environnement de Développement Intégré (EDI) Lazarus ([[Screenshots |capture d'écran en Anglais]]) est stable. Il a de nombreuses fonctionnalités pour créer des logiciels pouvant s'exécuter de façon autonome. Il fonctionne actuellement sous Linux, FreeBSD, Win32 et macOS. Lazarus fournit un éditeur de code source personnalisable, un environnement visuel de création de fiches, un gestionnaire de paquets, un débogueur et une interface graphique utilisateur (GUI) intégrée au compilateur FreePascal.
  
 
==Prise en main==
 
==Prise en main==
 
(Merci à [[User:Kirkpatc]])
 
(Merci à [[User:Kirkpatc]])
  
Téléchargez Lazarus dans la section 'Download' du [http://www.lazarus.freepascal.org| site officiel], [[Installing Lazarus|installez]] le et lancez le.
+
Téléchargez Lazarus dans la section 'Download' du [http://www.lazarus.freepascal.org site officiel], [[Installing Lazarus/fr|installez-le]] et lancez-le.
  
 
===Votre premier programme sous Lazarus !===
 
===Votre premier programme sous Lazarus !===
Plusieurs fenêtres apparaîtrons sur le bureau : le menu principal en haut, l'inspecteur d'objet à gauche, éditeur de source de Lazarus occupe la plus grande partie du bureau, et une fenêtre Form1 prête à être utilisée recouvrant l'éditeur de source.
+
Plusieurs fenêtres apparaîtront sur le bureau : le menu principal en haut, l'inspecteur d'objet à gauche, l'éditeur de source de Lazarus, qui occupe la plus grande partie du bureau, et une fenêtre Form1 prête à être utilisée recouvrant l'éditeur de source.
  
Sous le menu principal, vous trouverez plusieurs onglets. Si 'Standard' n'est pas déjà sélectionné, faite-le en cliquant dessus avec la souris et cherchez une icône représentant un bouton (un rectangle avec 'OK' marqué dessus), sélectionnez le avec la souris.  Ensuite cliquez sur la fenêtre 'Form1'.  Un rectangle ayant pour texte 'Button1' apparaîtra. Cliquez une nouvelle fois sur l'icône du bouton dans l'onglet 'Standard', et cliquez de nouveau sur Form1 : un rectangle ayant pour texte 'Button2' apparaîtra.
+
Sous le menu principal, vous trouverez plusieurs onglets. Si 'Standard' n'est pas déjà sélectionné, faites-le en cliquant dessus avec la souris et cherchez une icône représentant un bouton (un rectangle avec 'OK' marqué dessus), sélectionnez-le avec la souris.  Ensuite cliquez sur la fenêtre 'Form1'.  Un rectangle ayant pour texte 'Button1' apparaîtra. Cliquez une nouvelle fois sur l'icône du bouton dans l'onglet 'Standard', et cliquez de nouveau sur Form1 : un rectangle ayant pour texte 'Button2' apparaîtra.
 
 
Maintenant cliquez sur 'Button1' pour le sélectionner. L'inspecteur d'objet affichera les propriétés de l'objet 'Button1'. Elles sont triées par ordre alphabétique, cherchez 'Caption' elle devrait afficher la valeur 'Button1'. Cliquez dessus et changez 'Button1' en 'Press'. Si vous appuyez sur la touche ENTREE de votre clavier ou cliquez ailleurs, vous verrez le libellé de votre premier bouton de 'Form1' se changer en 'Press'. Ensuite cliquez sur l'onglet événements de l'inspecteur d'objet, pour voir les différents événements pouvant être associés au bouton. Cela inclus OnClick, OnEnter, OnExit etc. à présent, cliquez sur le bouton à droite de 'OnClick' <div class="box">...</div>. Lorsque vous le sélectionnez, vous êtes renvoyés automatique dans l'éditeur de source, et votre curseur directement à l'emplacement où le code doit être saisi :
 
  
 +
Maintenant cliquez sur 'Button1' pour le sélectionner. L'inspecteur d'objet affichera les propriétés de l'objet 'Button1'. Elles sont triées par ordre alphabétique, cherchez 'Caption' elle devrait afficher la valeur 'Button1'. Cliquez dessus et changez 'Button1' en 'Press'. Si vous appuyez sur la touche ENTREE de votre clavier ou cliquez ailleurs, vous verrez le libellé de votre premier bouton de 'Form1' se changer en 'Press'. Ensuite cliquez sur l'onglet 'Événements' de l'inspecteur d'objet, pour voir les différents événements pouvant être associés au bouton. Cela inclut OnClick, OnEnter, OnExit etc. À présent, cliquez sur le bouton à droite de 'OnClick' [...]. Lorsque vous le sélectionnez, vous êtes renvoyés automatiquement dans l'éditeur de source, et votre curseur directement à l'emplacement où le code doit être saisi :
 +
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   begin
 
   begin
     {now type:}    Button1.caption := 'Press again';
+
     {maintenant tapez :}    Button1.caption := 'Press again';
     {the editor has already completed the procedure with}
+
     {L'éditeur a déjà complété la procédure }
 
   end;
 
   end;
 
+
</syntaxhighlight>
 
Appuyez sur F12 pour sélectionner Form1 au lieu de l'éditeur de source.
 
Appuyez sur F12 pour sélectionner Form1 au lieu de l'éditeur de source.
  
Maintenant éditez les propriétés de 'Button2' : Cliquez sur 'Button2' pour afficher ses propriétés dans l'inspecteur d'objet. Changez la propriété 'Caption' en 'Exit' au lieu de 'Button2'. Maintenant sélectionnez l'onglet événement, et cliquez sur 'OnClick'. Cliquez ensuite sur le bouton figurant 3 points <div class="box">...</div>, une nouvelle procédure sera automatiquement déclarée et le curseur sera positionné directement dans le corps de celle-ci :
+
Maintenant, éditez les propriétés de 'Button2' : cliquez sur 'Button2' pour afficher ses propriétés dans l'inspecteur d'objet. Changez la propriété 'Caption' en 'Exit' au lieu de 'Button2'. Maintenant, sélectionnez l'onglet 'Événements', et cliquez sur 'OnClick'. Cliquez ensuite sur le bouton figurant 3 points [...], une nouvelle procédure sera automatiquement déclarée et le curseur sera positionné directement dans le corps de celle-ci :
 
+
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   begin
 
   begin
   {now type:}  Close;
+
   {maintenant tapez :}  Close;
   {the editor has already completed the procedure with}  
+
   {L'éditeur a déjà complété la procédure }  
 
   end;
 
   end;
 +
</syntaxhighlight>
 +
Maintenant, appuyez sur F12 pour revoir la fenêtre 'Form1'. Vous êtes maintenant prêt à compiler votre programme. La méthode la plus simple est de sélectionner 'Exécuter' dans le menu principal en haut de l'écran, et l'option 'Exécuter' dans le sous menu. Vous pouvez aussi appuyer, tout simplement, sur la touche F9 de votre clavier. Cette manipulation compilera votre programme, et (si tout se passe bien) l'exécutera.
  
Maintenant, appuyez sur F12 pour revoir la fenêtre 'Form1'. Vous êtes maintenant prêt à compiler votre programme. La méthode la plus simple est de sélectionner 'Exécuter' dans le menu principal en haut de l'écran, et l'option 'Exécuter' dans le sous menu. Vous pouvez aussi appuyez, tout simplement, sur la touche F9 de votre clavier. Cette manipulation compilera votre programme, et (si tout se passe bien) l'exécutera.
+
La fenêtre de texte en dessous de l'éditeur de source affichera différentes sortes d'informations sur la compilation (information, alerte, erreur...). Quelques instant plus tard, 'Form1' va réapparaître, mais sans la grille de points qui permet de positionner les composants (boutons, zones de saisie) en mode conception. C'est le fenêtre principale de votre application, elle attend que vous cliquiez sur le bouton 'Press'.
 
 
La fenêtre de texte en dessous de l'éditeur de source affichera différentes sortes d'information sur la compilation (information, alerte, erreur...). Quelques instant plus tard 'Form1' va réapparaître, mais sans la grille de points qui permet de positionner les composants (boutons, zones de saisie) en mode conception. C'est le fenêtre principal de votre application, elle attend que vous cliquiez sur le bouton 'Press'.
 
  
 
Essayez de cliquer sur le bouton 'Press'. Le libellé changera en 'Press again'. Si vous cliquez encore, le libellé continuera à afficher 'Press again' !
 
Essayez de cliquer sur le bouton 'Press'. Le libellé changera en 'Press again'. Si vous cliquez encore, le libellé continuera à afficher 'Press again' !
Line 41: Line 41:
 
Maintenant, cliquez sur le bouton marqué 'Exit'. La fenêtre se fermera et vous quitterez le programme. La fenêtre 'Form1' originale réapparaîtra en mode conception avec sa grille de points, prête à être modifiée de nouveau.
 
Maintenant, cliquez sur le bouton marqué 'Exit'. La fenêtre se fermera et vous quitterez le programme. La fenêtre 'Form1' originale réapparaîtra en mode conception avec sa grille de points, prête à être modifiée de nouveau.
  
A présent vous devriez sauvegarder votre travail (faites-le souvent !) sélectionnez :
+
A présent, vous devriez sauvegarder votre travail (faites-le souvent !) sélectionnez :
Projet > Enregistrer le projet sous > Nom de vos fichiers
+
Projet -> Enregistrer le projet sous... et indiquez les noms de vos fichiers.
 +
 
 +
ATTENTION : le nom de fichier de la "Unit" et du projet doivent être différents.
  
 
===Deuxième session===
 
===Deuxième session===
Rouvrir votre projet.
+
Rouvrez votre projet.
Cliquez sur le bouton 'Press' (Button1) de la fenêtre 'Form1'. Sélectionner l'onglet 'Évènements' dans l'inspecteur d'objet, cliquez sur le bouton prêt de 'OnClick' <div class="box">...</div>, pour retourner à l'emplacement approprié dans l'éditeur de source.
+
Cliquez sur le bouton 'Press' (Button1) de la fenêtre 'Form1'. Sélectionnez l'onglet 'Évènements' dans l'inspecteur d'objet, cliquez sur le bouton près de 'OnClick' [...], pour retourner à l'emplacement approprié dans l'éditeur de source.
  
 
Modifiez votre code de la manière suivante :
 
Modifiez votre code de la manière suivante :
 
+
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   procedure TForm1.Button1Click(Sender: TObject);
 
  {Makes use of the Tag property, setting it to either 0 or 1}
 
  {Makes use of the Tag property, setting it to either 0 or 1}
Line 63: Line 65:
 
     end
 
     end
 
   end;
 
   end;
 
+
</syntaxhighlight>
 
Sauvegardez votre travail, et compilez votre programme. Le bouton 'Press' basculera entre les deux messages ('Press' et 'Press again').
 
Sauvegardez votre travail, et compilez votre programme. Le bouton 'Press' basculera entre les deux messages ('Press' et 'Press again').
  
 
Le reste dépend de vous !
 
Le reste dépend de vous !
  
Si vous préférez programmer en mode console (ou mode texte), par exemple si vous apprenez les bases du Pascal, ou que vous aillez besoin d'un programme de traitement par lots (batch) ou encore que vous souhaitiez faire de la programmation système, vous pouvez conserver Lazarus pour éditer, compiler et exécuter votre programme. Il constitue un environnement idéal pour le développement en Pascal. Voir [[Console Mode Pascal]].
+
Si vous préférez programmer en mode console (ou mode texte), par exemple si vous apprenez les bases du Pascal, ou que vous ayez besoin d'un programme de traitement par lots (batch) ou encore que vous souhaitiez faire de la programmation système, vous pouvez conserver Lazarus pour éditer, compiler et exécuter votre programme. Il constitue un environnement idéal pour le développement en Pascal. Voir [[Console Mode Pascal|Console Mode Pascal]].
  
==L'Editeur==
+
==L'éditeur==
 
Lorsque vous lancez Lazarus, une série de fenêtres flottantes apparaît.
 
Lorsque vous lancez Lazarus, une série de fenêtres flottantes apparaît.
  
Le fenêtre principale en haut de l'écran est titrée '''Editeur Lazarus vXXXXXX - project1''' (les X correspondent au numéro de la version de Lazarus installée sur votre machine). C'est une fenêtre importante de votre projet, elle contient le menu principal et la palette de composants.
+
La fenêtre principale en haut de l'écran est titrée '''Editeur Lazarus vXXXXXX - project1''' (les X correspondent au numéro de la version de Lazarus installée sur votre machine). C'est une fenêtre importante de votre projet, elle contient le menu principal et la palette de composants.
  
 
<center>[[Image:Lazmainfr.jpg]]</center>
 
<center>[[Image:Lazmainfr.jpg]]</center>
Line 80: Line 82:
 
En dessous à gauche vous trouverez un jeu de "BitButtons" qui vous permettrons d'accéder aux fonctions les plus courantes. A droite se trouve la palette de composants.
 
En dessous à gauche vous trouverez un jeu de "BitButtons" qui vous permettrons d'accéder aux fonctions les plus courantes. A droite se trouve la palette de composants.
  
Under the Lazarus Editor window will appear the '''[http://lazarus-ccr.sourceforge.net/kbdata/objinsp.jpg Object Inspector]''' window on the left, and the '''[http://lazarus-ccr.sourceforge.net/kbdata/editor.jpg Lazarus Source Editor]''' on the rightThere may be another smaller window, labelled '''[http://lazarus-ccr.sourceforge.net/kbdata/blankform.jpg Form1]''', overlying the Lazarus Source Editor window. If this is not visible immediately, it can be made to appear by pressing the '''F12''' key, which toggles between the Source Editor view and the Form view. The Form window is the one on which you will construct the graphical interface for your application, while the Source Editor is the window which displays the Pascal code associated with the application which you are developingThe operation of the Object Inspector is discussed in more detail below while the Component Palette is described.
+
En dessous de la fenêtre de l'éditeur apparaît, à gauche de l'écran, la fenêtre de l''''[http://lazarus-ccr.sourceforge.net/kbdata/objinsp.jpg inspecteur d'objet]''', et l''''[http://lazarus-ccr.sourceforge.net/kbdata/editor.jpg éditeur de source de Lazarus]'''.  Il peut également y avoir une fenêtre plus petite, appelée '''[http://lazarus-ccr.sourceforge.net/kbdata/blankform.jpg Form1]''', recouvrant l'éditeur de source de Lazarus. Si 'Form1' n'est pas visible immédiatement, vous pouvez la faire apparaître en pressant '''F12''', qui basculera de l'éditeur de source au formulaire correspondant à l'unité en cours, et inversement. La fenêtre de conception de formulaire et l'un des outils que vous utiliserez le plus fréquemment pour mettre en place une interface utilisateur pour votre application.  Ce qu'il est possible de faire dans l'inspecteur d'objet est décrit plus en détail dans la section : Palette de composants.
  
When you start a new project (or when you first launch Lazarus) a default Form will be constructed, which consists of a box in which there is a grid of dots to help you to position the various components of the form, and a bar along the top which contains the usual '''Minimise''', '''Maximise''' and '''Close buttons'''. If you click with your mouse cursor anywhere in this box, you will see the properties of this form displayed in the Object Inspector on the left side of the desk-top.
+
Lorsque vous démarrez un nouveau projet, ou que vous lancez Lazarus pour la première fois, un formulaire par défaut apparaît. Ce formulaire consiste en une "boîte" contenant une grille de points qui vous aiderons à positionner les différents composants, une barre au sommet de la fenêtre contient les boutons habituels '''Réduire''', '''Agrandir''' et '''Fermer'''. Si vous cliquez avec le curseur de la souris à l'endroit que vous voulez dans la boîte, vous verrez les propriétés du formulaire s'afficher dans l'inspecteur d'objet à gauche de l'écran.
  
Other windows that may become visible during your work: the '''[http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg Project Inspector]''', which contains details of the files included in your project, and allows you to add files to or delete files from your project;  the '''Messages''' window, which displays compiler messages, errors or progress reports on your project; if Lazarus was launched from a terminal window, the original terminal remains visible and detailed compiler messages are also printed there.
+
D'autres fenêtres peuvent êtres affichées pendant votre travail : l''''[http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg inspecteur de projet]''' contient les détails des fichiers inclus dans votre projet, et vous permet également d'en rajouter ou d'en supprimer. La fenêtre de '''Messages''', affiche les informations de compilation, les erreurs ou les rapports d'avancement ; si Lazarus est lancé depuis une fenêtre de terminal, le terminal original reste toujours visible et affiche également des messages de compilation.
  
  
===The Main Menu===
+
===Menu principal===
  
The main menu line contains the following entries:
+
Le menu principal contient les entrées suivantes :
<u>F</u>ile  <u>E</u>dit  <u>S</u>earch  <u>V</u>iew  <u>P</u>roject <u>R</u>un <u>C</u>omponents  <u>T</u>ools  E<u>n</u>vironment  <u>W</u>indows  <u>H</u>elp
+
<u>F</u>ichier <u>E</u>dition <u>C</u>ercher <u>V</u>oir <u>P</u>roject <u>E</u>xécuter <u>C</u>omposants <u>O</u>utils <u>C</u>onfiguration <u>F</u>enêtres <u>A</u>ide
  
As usual, the options can be selected either by placing the mouse cursor over the menu option and clicking the left mouse button, or by typing Alt-F on the keyboard (provided the main menu window has focus:  if it has not, hit TAB repeatedly to cycle focus through the various windows until the desired window has its title bar highlighted in colour).
+
Comme d'habitude, les options peuvent êtres sélectionnées soit en cliquant directement dessus à l'aide du bouton gauche de la souris, soit en tapant au clavier : Alt, la lettre correspondante au menu voulu (par exemple F), Entrée.
  
====The File sub-menu====
+
Pour plus de détails consultez [[Main menu/fr]].
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/FileMenuSnapshot.png </div>
 
* '''New Unit''': Creates a new Unit file (Pascal Source).
 
* '''New Form''': Creates a new Form:  both the visual on-screen window and the associated Pascal source file.
 
* '''New ...''': Offers a pop-up menu box ([http://lazarus-ccr.sourceforge.net/kbdata/menu-new.jpg screenshot]) with a variety of new document types to create.
 
* '''Open''': Offers a pop-up Dialog Box to enable you to navigate the filesystem and choose an existing file to open.
 
* '''Revert''': Abandon editing changes and restore the file to its original state.
 
* '''Save''': Save the current file, using its original filename. If there is no name, the system will prompt for one (just like Save As).
 
* '''Save As''': Allows you to choose a directory and filename for saving the current file.
 
* '''Close''': Closes the current file, prompting wheter to save all editor changes.
 
* '''Close all editor files''': Close all files currently open in the editor.  Prompt for saving changes.
 
* '''Clean directory''': Offers a dialog with a series of editable filters for removing files from the current directory.  Useful for removing .bak files and remnants of former Delphi projects.
 
* '''Quit''': Exit Lazarus, after prompting for saving all edited files.
 
<div style="clear:both;"></div>
 
====The Edit sub-menu====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/EditMenuSnapshot.png </div>
 
* '''Undo''': Undo the last edit action, leaving the Editor in the state just before the last action.
 
* '''Redo''': Re-instates the last action that was reversed by Undo.
 
* '''Cut''': Remove the selected text or other item and place it on the Clipboard.
 
* '''Copy''': Make a copy of the selected text, leaving the original in place, and placing the copy on the Clipboard.
 
* '''Paste''': Places the contents of the Clipboard at the cursor position. If text has been selected at the cursor position, the contents of the Clipboard will replace the selected text.
 
* '''Indent selection''': Move the selected text to the right by the amount specified in Environment -> Editor options -> General -> Block indent.  This feature is useful for formatting your Pascal source code to show the underlying Block structure.
 
* '''Unindent selection''': Removes one level of indenting, moving the text to the left by the amount specified in Block indent.
 
* '''Enclose selection''': Provides a pop-up menu with a number of options for logically enclosing the selected text (begin ... end; try ... except; try ... finally; repeat ... until; { ... } etc).
 
* '''Uppercase selection''': Convert selected text to uppercase.
 
* '''Lowercase selection''': Convert selected text to lowercase.
 
* '''Tabs to spaces in selection''': Converts any tabs in the selected text to the number of spaces specified by Environment -> Editor options -> General -> Tab widths.  The number of spaces is not a fixed quantity, but is the number needed to fill the remaining width of the tab.
 
* '''Break lines in selection''': If any lines in the selected text are longer than 80 characters or the number specified in Environment -> Editor options -> Display -> Right Margin, then the line is broken at a word boundary and continued on the next line.
 
* '''Comment selection''': Makes the selected text into comments  by inserting // on each line.
 
* '''Uncomment selection''': Removes comment marks.
 
* '''Sort selection''': Sort lines (or words or paragraphs) alphabetically;  options for ascending or descending order, case sensitive or insensitive.  In the middle of program source code, of course, it makes no sense, but if you have a list you need to have sorted this will do the trick.
 
* '''Select''': Allows selection of blocks of text.  Options include select all, select to brace, select paragraph or line etc.
 
* '''Insert from character map''': Allows insertion of non-keyboard symbols such as accented characters, picked from a pop-up character map.
 
* '''Insert text''': Displays pop-up menu to allow insertion of standard text such as CVS keywords (Author, Date, Header etc) or GPL notice, username or Current date and time.
 
* '''Complete code''': Completes the code at the cursor. It is context sensitive and saves you a lot of time. For example: it completes classes, by adding private variables, Get and Set property access methods and adding method bodies. On variable assignments (e.g. i:=3;) it adds the variable declarations. On forward defined procedures it adds the procedure bodies. On event assignments (OnClick:=) it adds the method definition and the method body. Voir les [[Lazarus IDE Tools/fr|outils de l'EDI Lazarus]].
 
* '''Extract procedure''': Uses the selected text (a statement or series of statements) to build a new procedure.
 
<div style="clear:both;"></div>
 
  
====The Search sub-menu====
+
===La barre de boutons===
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/SearchMenuSnapshot.png </div>
+
C'est une barre d'outil à gauche de la fenêtre d'édition principale, juste au-dessous du menu principal et à gauche de la palette de composants, elle contient un jeu de boutons appelant les fonctions les plus fréquemment utilisées dans le menu :
* '''Find''': Similar to the facility in almost all graphic text editors:  a pop-up dialog box appears allowing entry of a search text string, with options such as case sensitivity, whole words, origin, scope and direction of search.
+
: '''Nouvelle unité''', '''Ouvrir''' (avec une flèche pointant vers le bas, affichant une liste des fichiers récemment utilisés), '''Enregistrer''', '''Tout enregistrer''', '''Nouvelle fiche''', '''Commutation Fiche/Unité''' (i.e. affiche la fiche ou le code source de l'unité), '''Afficher les unités''', '''Afficher les fiches''', '''Exécuter''' (i.e. compile et exécute), '''Pause''', '''Pas à pas approfondi''', '''Pas à pas''' (les deux derniers sont des fonctions de débogage).
* '''Find Next, Find previous''': Search again for the previously entered text string, in the specified direction.
 
* '''Find in files''': Search for text string in files:  pop-up dialog with options all open files, all files in project, or all directories;  masks available for selecting file types.
 
* '''Replace''': Similar to '''Find''';  shows pop-up dialog with place to enter search text string and replacement text, and options for case sensitivity, direction etc.
 
* '''Incremental find''': Search for the string while you are entering the search string. Example: after you choose "Incremental Find" if you press "l" the first "l" will be highlighted. If then you press "a", the editor will find the next "la" and so on.
 
* '''Goto line''': Move editing cursor to specified line in file.
 
* '''Jump back''': Move back in file to next Bookmark (need to have used '''Add jump point to history'''). Will move to Bookmarks in other files open in the Editor.
 
* '''Jump forward''': Move forward to next Bookmark.
 
* '''Add jump point to history''': Add Bookmarks or jump points to file.
 
* '''View Jump-History''': Look at list of bookmarks in file: '''Not implemented yet'''.
 
* '''Find other end of code block''': If positioned on a '''begin''', finds the corresponding '''end''' or vice versa.
 
* '''Find code block start''': Moves to the '''begin''' of the procedure or function in which the cursor is placed.
 
* '''Find Declaration at cursor''': Finds the place at which the selected identifier is declared.  This may be in the same file or another file already open in the Editor;  if the file is not open, it will be opened (so if a procedure or function is declared, for example, in <u>classesh.inc </u>, this will be opened in the Editor).
 
* '''Open filename at cursor''': Opens the file whose name is selected at the cursor.  Useful for looking at <u>Include </u> files or the files containing other <u>Units </u> used in the project.
 
* '''Goto include directive''': If the cursor is positioned in a file which is <u>Included</u> in another file, goes to the place in the other file that called the <u>Include</u> file.
 
'''<div style="clear:both;"></div>
 
  
====The View sub-menu====
+
==La palette de composants==
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ViewMenuSnapshot.png </div>
+
La barre d'outils à onglets affiche un large choix d'icônes représentant les composants les plus courants pour la conception de formulaires.
Controls the display of various windows and panels on the screen.
 
* '''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, color, 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''': 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, it includes the usual Edit Cut, Copy or Paste functions, ''Find Declaration'' and ''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 color syntax highlighting on the code, with different colors 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''': 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...''': 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...''': 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''': 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.
 
* '''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.
 
* '''Messages''': A window that displays compiler messages, showing the progress of a successful compilation or listing the errors found.
 
* '''Search Results''': A window that displays the results of find in files.
 
* '''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.
 
<div style="clear:both;"></div>
 
  
====The Project sub-menu====
+
Chaque onglet affiche un jeu d'icônes, correspondant aux fonctionnalités du groupe de composants. L'icône la plus à gauche, figurant une flèche, est appelée outil de sélection.
<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 from file''': A Navigation dialog window appears, alowing selection of a file from which to create a new project.
 
* '''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 Recent Project''': Displays a pop-up list of recent projects on which you have been working, and allows selection of one of these.
 
* '''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 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]]).
 
* '''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. Voir les [[Lazarus IDE Tools/fr|outils de l'EDI Lazarus]]
 
* '''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 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 at start of application) and Info (specifying whether editor information should be saved for closed files, or only for project files).
 
* '''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.
 
* '''Add editor file to Project''': Add the file currently being edited to the Project
 
* '''Remove from Project''': Gives a pop-up menu of files available for removal from project.
 
* '''View Source''': No matter which file you are editing, takes you back to the main program file (.lpr)or the main .pas file if there is no .lpr.
 
* '''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. Remember there should be no spaces on the line before //TODO and ToDo comments added after the last save will not be shown!
 
  
====The Run sub-menu====
+
Si vous placez le pointeur de la souris sur l'une des icônes sans cliquer dessus, sont nom s'affichera. Notez que chaque nom commence par un 'T', ce qui signifie 'Type' ou plus précisément 'Class' de composant. Lorsque vous sélectionnez un composant pour l'intégrer dans un formulaire, la classe est ajoutée dans la section '''type''' de la partie '''interface''' de l'unité (habituellement en tant que partie de TForm1), et une instance de cette classe est ajoutée dans la section '''var''' (habituellement de la même manière que la variable Form1). Chaque '''méthode''' que vous écrivez pour être utilisée par le formulaire ou ses composants (i.e. Procédures ou Fonctions) sera placée dans la partie '''implementation''' de l'unité.
<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 changed since the last build.
 
* '''Build all''': Builds all files in the project, whether or not there have been any changes.
 
* '''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.
 
  
* '''Run''': This is the usual way to  launch the compiler and, if compilation is successful, to start execution of the applicationWhat 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.
+
Dans la liste suivante, vous trouverez des liens vers les fichiers qui contiennent la description de ses composants. Si vous souhaitez trouver les propriétés d'un composant en particulier, il peut être utile d'étudier le composant duquel il est dérivé (son parent). Par exemple, pour comprendre TMaskEdit, il est également utile d'examiner TCustomMaskEdit.
* '''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.
+
'''ONGLETS''' (les noms sont largement explicites) :
* '''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.
+
* '''Standard'''
* '''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 stopsResume execution at normal speed by selecting '''Run'''.
+
<center>[[image:Component_Palette_Standart.png]]</center>
* '''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).
+
:''Les composants fréquemment utilisés :''  
 +
:[http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html TMainMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html TPopupMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html TButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html TLabel], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html TEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html TMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html TToggleBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html TCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html TRadioButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html TListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html TComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html TScrollBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html TGroupBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html TRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html  TCheckGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html TPanel], [http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html TActionList]
 +
* '''Additional'''
 +
<center>[[image:Component_Palette_Additional.png]]</center>
 +
:''Des composants souvent utilisés en complément :''
 +
:[http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html TBitBtn], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html TSpeedButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html TStaticText], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html TImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html TShape], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html TBevel], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html TPaintBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html TNotebook], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html TLabeledEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html TSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html TCheckListBox], [http://lazarus-ccr.sourceforge.net/index.php?wiki=FormsTxt#TScrollBox TScrollBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html TApplicationProperties], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html TStringGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html TDrawGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html TPairSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorbox.html TColorBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorlistbox.html TColorListBox], TChart
 +
* '''Common Controls'''
 +
<center>[[image:Component_Palette_Common_Controls.png]]</center>
 +
: [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttrackbar.html TTrackBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tprogressbar.html TProgressBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttreeview.html TTreeView], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tlistview.html TListView], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tstatusbar.html TStatusBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttoolbar.html TToolBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tupdown.html TUpDown], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tpagecontrol.html TPageControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttabcontrol.html TTabControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/theadercontrol.html THeaderControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/controls/timagelist.html TImageList]
 +
* '''Dialogs'''
 +
<center>[[image:Component_Palette_Dialogs.png]]</center>
 +
: [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/topendialog.html TOpenDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tsavedialog.html TSaveDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tselectdirectorydialog.html TSelectDirectoryDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcolordialog.html TColorDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfontdialog.html TFontDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfinddialog.html TfindDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/treplacedialog.html TReplaceDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/topenpicturedialog.html TOpenPictureDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tsavepicturedialog.html TSavePictureDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalendardialog.html TCalendarDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalculatordialog.html TCalculatorDialog], TPrinterSetupDialog, TPrintDialog, TPageSetupDialog
  
* '''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.
+
Beaucoup de procédures ou de fonctions utiles comme les [[Dialog_Examples/fr|boîtes de dialogue]] n'apparaissent pas directement dans la palette de composants, mais peuvent être facilement appelées dans le code source du programme.
: 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
 
"xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied". 
 
: 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.
 
: 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.
 
: See the separate tutorial on [[Console Mode Pascal]] programming.
 
* '''Reset debugger''': Restores the debugger to its original state, so that breakpoints and values of variables etc are forgotten.
 
  
* '''Build file''': Compile (build) just the file that is currently open in the Editor.
+
Pour quelques bons exemples sur l'utilisation des composants, voir le sous-répertoire $LazarusPath/lazarus/examples de votre installation. Beaucoup de ces programmes montrent comment utiliser les boîtes de dialogue et d'autres composants directement sans utiliser l'EDI et la palette de composants, ou des définition de fichier séparés : tous les composants sont complets et explicitement définis dans le programme Pascal principal. D'autres exemples de programmes utilisent pleinement l'EDI.
* '''Run file''': Compile, link and execute just the currently open file.
 
* '''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.
 
:These last three options enable you to open (and maintain) a test project. Use File -> Open to open an .lpr file, pressing cancel on the next dialog to open this file as "normal source" file.  
 
  
<div style="clear:both;"></div>
+
Certains exemples ne fonctionnent pas immédiatement : vous pourriez avoir besoin de modifier les chemins et les permissions des fichiers des répertoires. Si vous souhaitez compiler quelques exemples, faites attention à avoir les permissions de lecture/écriture/exécution pour les fichiers et les répertoires, ou copiez les fichiers dans un répertoire sur lequel vous avez les permissions appropriées.
  
====The Components sub-menu====
+
Essayez d'exécuter le programme 'testall' pour voir un menu des composants disponibles ainsi que de petits exemples de formulaires de test pour la plupart d'entre eux ; ensuite inspectez le code pour comprendre comment ils fonctionnent !
* '''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.
+
* '''Misc'''
* '''Open Package File''': Open one of the files in the selected package.
+
<center>[[image:Component_Palette_Misc.png]]</center>
* '''Open Recent Package''': Open a package that was opened recently.
+
: [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcolorbutton.html TColorButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tspinedit.html TSpinEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tfloatspinedit.html TFloatSpinEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/arrow/tarrow.html TArrow], [http://lazarus-ccr.sourceforge.net/docs/lcl/calendar/tcalendar.html TCalendar], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/teditbutton.html TEditButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tfilenameedit.html TFileNameEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdirectoryedit.html TDirectoryEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.html TDateEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tcalcedit.html TCalcEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/filectrl/tfilelistbox.html TFileListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/xmlpropstorage/txmlpropstorage.html TXMLPropStorage], [http://lazarus-ccr.sourceforge.net/docs/lcl/inipropstorage/tinipropstorage.html TIniPropStorage], [http://lazarus-ccr.sourceforge.net/docs/lcl/chart/tbarchart.html TbarChart], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttonpanel/tbuttonpanel.html TButtonPanel], TIDEDialogLayoutStorage
* '''Add Active Unit to Package''': Place the unit file (currently in the editor) into a package.
+
* '''Data Controls'''
* '''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).
+
<center>[[image:Component_Palette_DataControls.png]]</center>
* '''Configure custom components''': If you have created some components, allows you to configure them.
+
: ''Composants orientés données, qui copient très largement les groupes Standard et Additionnel mais sont applicables aux bases de données :'' [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcustomnavigator.html TDBNavigator], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbtext.html TDBText], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbedit.html TDBEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbmemo.html TDBMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbimage.html TDBImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdblistbox.html TDBListBox],[http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcombobox.html TDBComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcheckbox.html TDBCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbradiogroup.html TDBRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcalendar.html TDBCalendar], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbgroupbox.html TDBGroupBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbgrids/tdbgrid.html TdbGrid]
 +
* '''Data Access'''
 +
<center>[[image:Component_Palette_DataAccess.png]]</center>
 +
: TDatasource, TMemDataset (Package MemDSLaz), TSdfDataSet (Package SDFLaz), TFixedFormatDataSet (Package SDFLaz), TDbf (Package DBFLaz)
 +
* '''System'''
 +
<center>[[image:Component_Palette_System.png]]</center>
 +
: [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttimer.html TTimer], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tidletimer.html TIdleTimer], [http://lazarus-ccr.sourceforge.net/docs/lcl/lresources/tlazcomponentqueue.html TLazComponentQueue], [http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlhelpdatabase.html THTMLHelpDatabase], [http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlbrowserhelpviewer.html THTMLBrowserHelpViewer], TProcess, TSimpleIPCClient, TSimpleIPCServer, TXMLConfig
 +
* '''SynEdit'''
 +
<center>[[image:Component_Palette_SynEdit.png]]</center>
 +
: ''Un groupe de composants pour aider à interfacer d'autres langage et outils logiciels. SynEdit est un puissant composant d'édition multiligne, pour Borland Delphi, Kylix  et C++ Builder. Il supporte la coloration syntaxique et la complétion de code, et il inclut l'export aux formats html, tex et rtf. C'est un contrôle VCL/CLX à part entière, ce qui signifie qu'il n'encapsule pas un contrôle Microsoft Windows, et qu'aucune bibliothèque d'exécution n'est requise ; cela fait de SynEdit un composant multi-plateforme. La compatiblité avec FreePascal est également prévue, et SynEdit est le composant d'édition dans l'EDI Lazarus.'' voir [http://synedit.sourceforge.net synedit sur sourceforge].
 +
:TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynAnySyn, TSynMultiSyn
 +
 
 +
=== Comment utiliser la Palette ===
 +
Pour utiliser une palette, il faut afficher une fiche dans l'éditeur (s'il n'y en a pas, sélectionnez Fichier -> Nouvelle fiche). Cliquez sur l'icône du composant que vous souhaitez utiliser dans l'onglet approprié de la palette, et cliquez sur la fiche, vous verrez le composant apparaître. À ce moment là, vous pourrez le sélectionner à l'aide de la souris, et le déplacer à l'endroit que vous souhaitez sur la fiche et ajuster sa taille.  Les ajustements peuvent être effectués directement sur l'image du composant sur la fiche ou en modifiant ses propriétés dans l'éditeur d'objet.
 +
 
 +
Si vous installez des composants additionnels, que ce soit des composants que vous avez vous-même écrits, ou des paquets provenant d'autre sources, de nouveaux onglets apparaîtront dans la palette de composants. Ces nouveaux composants peuvent être sélectionnés et utilisés sur vos fiches de la même manière que ceux fournis par défaut.
 +
 
 +
== Comment utiliser les contrôles ''Standard'', ''Common'' et étendus ==
 +
<p>Les Unités <i>StdCtrls</i>, <i>ComCtrls</i> et <i>ExtCtrls</i> contiennent les définitions et les descriptions de beaucoup des contrôles les plus fréquemment utilisés pour la construction de fiches et d'autres objets dans les applications Lazarus.</p>
 +
          <p>De nombreux contrôles finaux utilisés par les développeurs, tels que <i>TButton</i>, <i>TMemo</i>, <i>TScrollBar</i> etc., correspondent à une classe ancêtre comme, respectivement, <i>TCustomButton</i>, <i>TCustomMemo</i> ou <i>TCustomScrollBar</i>. Plusieurs propriétés et méthodes relatives au contrôle final sont définies (et expliquées) plus complètement dans la classe <i>TCustomXXX</i>, le contrôle final en <b>héritant</b>.</p>
 +
          <p>Si vous déposez un composant dans l'éditeur de fiche, vous n'avez pas besoin d'ajouter de code pour le créer. Le composant est automatiquement généré par l'EDI, ainsi que la fiche,  et détruit lorsque la fiche est détruite.</p>
 +
          <p>Cependant, si vous créez un composant vous-même par programmation, n'oubliez pas de le libérer lorsqu'il n'est plus utilisé.</p>
 +
          <p>Si vous placez un composant dans l'éditeur de fiche et que vous regardez dans l'inspecteur d'objets, vous pourrez observer les propriétés changer en même temps que vous déplacez le composant.</p>
 +
          <p>Par exemple placez un bouton (TButton) sur le formulaire, cliquez dessus pour le sélectionner, puis déplacez-le avec la souris. Vous verrez  alors les valeurs Top et Left changer au fur et à mesure dans l'inspecteur d'objets pour refléter sa position. Si vous utilisez les poignées de redimensionnement du bouton  pour modifier sa taille, vous verrrez  les propriétés Height et Width changer de la même façon.</p>
 +
          <p>Inversement, vous pouvez saisir dans l'inspecteur d'objets une valeur associée à une propriété, par exemple la hauteur (Height); vous verrez  la taille de l'objet sur le formulaire changer pour correspondre à  cette  valeur.</p>
 +
          <p>You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example</p>
 +
          <code>Form1.Button1.Height := 48;</code>
 +
          <p>If 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.</p>
 +
          <p>En résumé, il existe généralement trois méthodes différentes pour déterminer chaque propriété d'un objet:</p>
 +
          <ul>
 +
            <li>en utilisant la souris ;</li>
 +
            <li>en définissant les valeurs dans l'inspecteur d'objets;</li>
 +
            <li>ou explicitement en écrivant du code.</li>
 +
          </ul>
 +
          <p>La plupart des  composants définis dans ces unités ont plusieurs propriétés communes ;  d'autres sont spécifiques aux composants individuels. Nous décrirons ici les plus courantes. Des propriétés inhabituelles ou spécifiques à un contrôle seront décrites pour les contrôles individuels. </p>
 +
          <p>De l'aide peut être obtenue en sélectionnant une propriété  ou un  mot clé, (dans l'inspecteur d'objet ou dans l'éditeur de source), puis en pressant {{keypress|F1}}. La page correspondante s'ouvrira alors. </p>
 +
          <p>If 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.</p>
 +
          <p>
 +
            <i>Constructors</i>
  
====The Tools sub-menu====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ToolsMenuSnapshot.png </div>
 
* '''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''': Makes the selected string a resource string by placing it in the resourcestrings section. An advantage of resource strongs is you can change them without the need to recompile your project!
 
* '''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.
 
<div style="clear:both;"></div>
 
  
====The Environment sub-menu====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/EnvironmentMenuSnapshot.png </div>
 
* '''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);
 
** '''Outils de code''' - 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 (not implemented).
 
* '''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''': Here you can see all IDE internal definitions to parse sources. You will see all the defines, unit, source, include paths for all source directories. Beginning with the settings of the current FPC, the defines for the Lazarus Source directory, all package directories and project directories.
 
Most of these settings are auto generated and read only.
 
  
  
* '''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:
 
*# Check the fpc source directory setting in the environment option.
 
*# Re-scan FPC source directory.
 
  
====The Windows sub-menu====
 
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/WindowsMenuSnapshot.png </div>
 
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.
 
<div style="clear:both;"></div>
 
  
====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===
+
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.</p>
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:
+
          <p>
: '''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).
+
            <i>Destructors:</i>
  
==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):
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=StdCtrls Standard]'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/4/4d/Component_Palette_Standart.png</center>
 
:''Frequently used components:'' [http://lazarus-ccr.sourceforge.net/index.php?wiki=MenuUnit TMainMenu], [http://lazarus-ccr.sourceforge.net/index.php?wiki=MenuUnit TPopupMenu], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TButton], TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox, TStaticText, [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TRadioGroup], TCheckGroup, [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TPanel], TActionList
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls Additional]'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/7/7d/Component_Palette_Additional.png</center>
 
:''More, often-used components:'' [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TBitBtn], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TSpeedButton], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TImage], TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, [http://lazarus-ccr.sourceforge.net/index.php?wiki=MaskEdit TMaskEdit], TCheckListBox, [http://lazarus-ccr.sourceforge.net/index.php?wiki=FormsTxt TScrollBox], [http://lazarus-ccr.sourceforge.net/index.php?wiki=FormsTxt TApplicationProperties], TStringGrid, TDrawGrid, TPairSplitter
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ComCtrls Common Controls]'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/4/4a/Component_Palette_Common_Controls.png</center>
 
: TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt Dialogs]'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/7/72/Component_Palette_Dialogs.png</center>
 
: TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog
 
  
Beaucoup de procédures ou de fonctions utiles comme les [[Dialog_Examples|boîtes de dialogue]] n'apparaissent pas directement dans la palette de composants, mais peuvent être facilement appelées dans le code source du programme.
 
  
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.
 
  
Try 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'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/8/8e/Component_Palette_Misc.png</center>
 
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt TColorButton], TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox
 
* '''Data Controls'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/6/62/Component_Palette_DataControls.png</center>
 
: ''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'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/c/cc/Component_Palette_DataAccess.png</center>
 
: TDatasource
 
* '''System'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/f/fe/Component_Palette_System.png</center>
 
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TTimer], TIdleTimer, TProcess
 
* '''SynEdit'''
 
<center>http://lazarus-ccr.sourceforge.net/kb/images/2/22/Component_Palette_SynEdit.png</center>
 
: ''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 [http://synedit.sourceforge.net 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.
+
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>.</p>
 +
          <p>Take the following precautions when creating your own <i>Destroy</i> method:</p>
 +
          <ul>
 +
            <li>Declare <i>Destroy</i> with the <b>override</b> directive, because it is a <b>virtual</b> method.</li>
 +
            <li>Always call '<i>inherited Destroy;</i>' as the last thing on the destructor code.</li>
 +
            <li>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.</li>
 +
            <li>Remember to call <i>Free</i> for all objects created on the constructor.</li>
 +
          </ul>
 +
<br/>
 +
          <table>
 +
            <caption><b>Some commonly listed properties</b></caption>
 +
            <tr><td><b>Property</b></td><td><b>Meaning</b></td></tr>
 +
            <tr>
 +
              <td>Action</td>
 +
              <td>The main action or event associated with the object. For example selecting an 'Exit' Button might cause the 'Close' action</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Align</td>
 +
              <td>Defines 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)</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Anchor</td>
 +
              <td>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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>AutoSelect</td>
 +
              <td>When True, an editing control will select all its text when it receives focus or when the Enter key is pressed.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>AutoSelected</td>
 +
              <td>True 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>BorderSpacing</td>
 +
              <td>The space around the edge between an <i>Anchored</i> control and its parent.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Caption</td>
 +
              <td>The 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>CharCase</td>
 +
              <td>Indicates 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</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Constraints</td>
 +
              <td>Sets 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Color</td>
 +
              <td>The Colour to be used to draw the control or to write the text it contains.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Enabled</td>
 +
              <td>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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Font</td>
 +
              <td>The 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Hint</td>
 +
              <td>A short piece of informative pop-up text that appears if the mouse-cursor hovers over the control.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Items</td>
 +
              <td>The 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</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Lines</td>
 +
              <td>An 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]</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Name</td>
 +
              <td>The 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>PopUpMenu</td>
 +
              <td>A window containing context-sensitive menu information that pops up when the right mouse button is clicked on the object.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Position (or Top, Left)</td>
 +
              <td>Determines where the control is located on the parent form or window</td>
 +
            </tr>
 +
            <tr>
 +
              <td>ReadOnly</td>
 +
              <td>Boolean 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>ShowHint</td>
 +
              <td>Allows a small window containing a context-sensitive Help or other description to be displayed when the mouse cursor 'hovers' over the control.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Size (or Height and Width)</td>
 +
              <td>The dimensions of the control</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Style</td>
 +
              <td>The options available for Style depend upon the sort of Control being considered: for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>TabOrder</td>
 +
              <td>Integer defining where in the sequence of tabs on the Form this control is to lie</td>
 +
            </tr>
 +
            <tr>
 +
              <td>TabStop</td>
 +
              <td>Boolean property which if True places this control in the sequence of objects that the user can reach by successively pressing the Tab key</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Text</td>
 +
              <td>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>.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Visible</td>
 +
              <td>If true, the object can be seen on the Form; if False, object is hidden</td>
 +
            </tr>
 +
            <tr>
 +
              <td>WordWrap</td>
 +
              <td>Logical 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.</td>
 +
            </tr>
 +
          </table>
 +
          <p>Many 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.</p>
 +
          <p>While 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.</p>
 +
          <p>The 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.</p>
 +
          <p>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.</p>
 +
<br/>
 +
          <table>
 +
            <caption><b>Some commonly listed Actions</b></caption>
 +
            <tr>
 +
              <td><b>Action</b></td>
 +
              <td><b>Meaning</b></td>
 +
            <tr>
 +
              <td>OnChange</td>
 +
              <td>Action to be taken if any change is detected (eg mouse move, mouse click, key press, edit text, alter picture, etc)</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnClick</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>Click</td>
 +
              <td>A 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnDragDrop</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnEntry</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnExit</td>
 +
              <td>Action to be taken when the mouse moves out of the area of the object, usually transferring focus out of the object.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnKeyPress</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnKeyDown</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>On Key Up</td>
 +
              <td>Action to be taken if a key is up (ie not pressed) while focus is in this control.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnMouseMove</td>
 +
              <td>On Mouse Down - Action to be taken if the mouse cursor moves while focus is in this control.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnMouseDown</td>
 +
              <td>Action to be taken if the mouse button is down while focus is in this control.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnMouseUp</td>
 +
              <td>Action 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.</td>
 +
            </tr>
 +
            <tr>
 +
              <td>OnResize</td>
 +
              <td>Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc.</td>
 +
            </tr>
 +
          </table>
 +
 
 +
== Comment utiliser les Menus ==
 +
Trucs et astuces pour l'ajout de Menus dans vos Fiches.
 +
 
 +
''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
 +
 
 +
Main 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.
 +
 
 +
To 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.
 +
 
 +
An 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.
 +
 
 +
Any or all of the ''MenuItems'' that you add can be configured using the Object Inspector.
 +
 
 +
At 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"
 +
 
 +
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 {{keypress|Ctrl}}+{{keypress|C}} for Copy or {{keypress|Ctrl}}+{{keypress|V}} for Paste - the standard Keyboard shortcuts) with the ''ShortCut'' property of the MenuItem.
 +
 
 +
It 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.
 +
 
 +
By 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.
 +
 
 +
==Le débogueur==
 +
: ''Reste encore à écrire''.
  
==The Debugger==
+
voir également [[:category: IDE Window - Debug]]
: ''Still to be written''.
 
  
==The Lazarus files==
+
==Les fichiers de Lazarus==
 
     (Thanks to Kevin Whitefoot.)
 
     (Thanks to Kevin Whitefoot.)
 
     (Additions by Giuseppe Ridinò, [[User:Kirkpatc]] and Tom Lisjac)
 
     (Additions by Giuseppe Ridinò, [[User:Kirkpatc]] and Tom Lisjac)
When you save you will actually be saving two files:  
+
Lorsque vous enregistrez, vous sauvez en réalité deux fichiers :  
  
   xxx.pas and yyy.lpr  
+
   xxx.pas et 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.
+
(En fait en vous enregistrez plus que ça, mais ces deux-là sont les seuls auxquels vous donnez un nom). Le fichier de projet '''.lpr''' et le fichier d'unité '''.pas''' ne doivent pas avoir le même nom car Lazarus attribuera automatiquement à l'unité (dans le code source) le nom du fichier d'unité, et au programme, le nom du fichier de projet (sinon, le compilateur pourrait ne pas retrouver l'unité quand le fichier de projet y fera référence). Bien sûr, pour être cohérent, il change toute les occurrences de Unit1 en 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.
+
Par conséquent, si vous enregistrez un fichier appelé '''encore''', encore.pas et encore.lpr, la compilation échouera car les noms de l'unité et du programme sont les mêmes ce qui entraînera une erreur.
  
So here is what I ended up with:
+
Les fichiers sont donc :
  
e:/lazarus/kj/lazhello:
+
e:/lazarus/kj/lazhello
 
  total 4740  free 76500
 
  total 4740  free 76500
  -rwxrwxrwx  1 kjwh    root  4618697 Mar 24 11:19 again.exe
+
  -rwxrwxrwx  1 kjwh    root  4618697 Mar 24 11:19 encore.exe
  -rw-rw-rw-  1 kjwh    root    3002 Mar 24 11:21 again.lpi
+
  -rw-rw-rw-  1 kjwh    root    3002 Mar 24 11:21 encore.lpi
  -rw-rw-rw-  1 kjwh    root      190 Mar 24 11:18 again.lpr
+
  -rw-rw-rw-  1 kjwh    root      190 Mar 24 11:18 encore.lpr
  -rw-rw-rw-  1 kjwh    root      506 Mar 24 11:08 againu.lfm
+
  -rw-rw-rw-  1 kjwh    root      506 Mar 24 11:08 encoreu.lfm
  -rw-rw-rw-  1 kjwh    root      679 Mar 24 11:08 againu.lrs
+
  -rw-rw-rw-  1 kjwh    root      679 Mar 24 11:08 encoreu.lrs
  -rw-rw-rw-  1 kjwh    root      677 Mar 24 11:08 againu.pas
+
  -rw-rw-rw-  1 kjwh    root      677 Mar 24 11:08 encoreu.pas
  -rw-rw-rw-  1 kjwh    root    2124 Mar 24 11:08 againu.ppu
+
  -rw-rw-rw-  1 kjwh    root    2124 Mar 24 11:08 encoreu.ppu
 
  -rwxrwxrwx  1 kjwh    root      335 Mar 24 11:07 ppas.bat
 
  -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.
+
Note : il y a plus de fichiers que les deux que j'ai enregistrés.
  
Here is a brief note about each file:
+
Ci-dessous un bref commentaire sur chacun des fichiers :
  
'''again.exe:'''
+
'''encore.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.
+
l'exécutable du programme. Win32 ajoute l'extension '''.exe''', mais pas Linux. Ce fichier sera très gros sous Linux à cause de l'inclusion des symboles de débogage (il est prévu de résoudre ce problème). Cependant, vous pouvez exécuter l'utilitaire "strip" pour supprimer ces symboles et réduire de façon substantielle la taille de l'exécutable.
  
'''again.lpi:'''
+
'''encore.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.
+
c'est le fichier principal d'un projet Lazarus (Lazarus Project Information) ; l'équivalent Delphi du fichier '''.dpr'''. Il est enregistré dans un dialecte XML et contient des instructions concernant toutes les bibliothèques et unités requises pour la compilation de l'exécutable.
  
'''again.lpr:'''
+
'''encore.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.
+
c'est le fichier source principal du programme ou fichier maître. En dépit du fait qu'il ait une extension spécifique à Lazarus, il s'agit en fait d'un fichier source Pascal parfaitement normal. Il possède une clause '''uses''' qui permet au compilateur de trouver toutes les unités nécessaires. Veuillez noter que le nom du programme et celui du fichier n'ont pas besoin d'être identiques. Ce fichier est habituellement plutôt petit, ne comportant que quelques assertions permettant d'initialiser et construire les fiches, et démarrer et terminer l'application. Le gros du travail est effectué dans les fichiers sources des unités, dont l'extension est '.pas'.
  
'''againu.lfm:'''
+
'''encoreu.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.
+
c'est ici que Lazarus stocke les paramètres de la fiche (position, taille...), sous forme compréhensible. C'est le reflet des propriétés de divers composants, telles qu'elles apparaissent dans l'Inspecteur d'objet. Chaque description d'objet débute par une ligne :
 +
object xxxx
 +
  suit une liste de propriétés y compris les objets encapsulés ou les sous-objets) puis la ligne
 +
end
 +
Lazarus utilise ce fichier pour générer la ressource incluse dans la section d'initialisation de l'unité encoreu.pas. Les fichiers '''.dfm''' de Delphi peuvent être convertis au format '''.lfm''' dans l'EDI de Lazarus en utilisant la commande ''Outils->Convertir un fichier DFM en fichier LFM...''.
  
'''again.lrs:'''
+
'''encore.lrs :'''
This is the generated resource file. Note that it is not a Windows resource file.
+
c'est le fichier de ressource qui contient les instructions permettant au programme de construire la fiche. Si vous regardez le fichier de l'unité principale, vous verrez dans la section d'initialisation la ligne
 +
{$i againu.lrs}
 +
qui commande au programme de charger le fichier de ressources. Notez que ce n'est pas un fichier de ressources Windows.
  
'''againu.pas:'''
+
'''encoreu.pas :'''
The unit that contains the code for the form.
+
ce fichier d'unité contient votre code correspondant à cette fiche. C'est habituellement le seul fichier que le développeur a besoin d'éditer ou inspecter. Il contient tout le code spécifiquement ajouté par le développeur (en particulier, les 'event handlers').  
  
'''again.ppu:'''
+
'''encore.ppu :'''
This is the compiled unit.
+
l'unité compilée. Elle est liée à l'exécutable, ainsi les autres unités citées dans la section '''Uses'''.  
  
'''ppas.bat:'''
+
'''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.
+
c'est un simple script qui lie (link) le programme pour produire l'exécutable. Si la compilation réussit, il est effacé par le compilateur.
  
==Original contributors and changes==
+
==Contributeurs originaux et changements==
This page has been imported from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial version].
+
Cette page a été importée de [http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial epikwiki].
 
* Created initial page and template. T. Lisjac - 11/04/2003 [[User:Tom | VlxAdmin]]
 
* Created initial page and template. T. Lisjac - 11/04/2003 [[User:Tom | 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]]
 
* 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]]

Latest revision as of 02:53, 8 December 2021

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) italiano (it) 日本語 (ja) македонски (mk) Nederlands (nl) português (pt) русский (ru) slovenčina (sk) shqip (sq) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

Ceci est le début du Tutoriel Lazarus. N'hésitez pas à y ajouter vos expériences.

Vue d'ensemble

Lazarus est un outil de développement libre et open source dédié au compilateur FreePascal (Pascal objet). FreePascal est également libre et open source. L'environnement de Développement Intégré (EDI) Lazarus (capture d'écran en Anglais) est stable. Il a de nombreuses fonctionnalités pour créer des logiciels pouvant s'exécuter de façon autonome. Il fonctionne actuellement sous Linux, FreeBSD, Win32 et macOS. Lazarus fournit un éditeur de code source personnalisable, un environnement visuel de création de fiches, un gestionnaire de paquets, un débogueur et une interface graphique utilisateur (GUI) intégrée au compilateur FreePascal.

Prise en main

(Merci à User:Kirkpatc)

Téléchargez Lazarus dans la section 'Download' du site officiel, installez-le et lancez-le.

Votre premier programme sous Lazarus !

Plusieurs fenêtres apparaîtront sur le bureau : le menu principal en haut, l'inspecteur d'objet à gauche, l'éditeur de source de Lazarus, qui occupe la plus grande partie du bureau, et une fenêtre Form1 prête à être utilisée recouvrant l'éditeur de source.

Sous le menu principal, vous trouverez plusieurs onglets. Si 'Standard' n'est pas déjà sélectionné, faites-le en cliquant dessus avec la souris et cherchez une icône représentant un bouton (un rectangle avec 'OK' marqué dessus), sélectionnez-le avec la souris. Ensuite cliquez sur la fenêtre 'Form1'. Un rectangle ayant pour texte 'Button1' apparaîtra. Cliquez une nouvelle fois sur l'icône du bouton dans l'onglet 'Standard', et cliquez de nouveau sur Form1 : un rectangle ayant pour texte 'Button2' apparaîtra.

Maintenant cliquez sur 'Button1' pour le sélectionner. L'inspecteur d'objet affichera les propriétés de l'objet 'Button1'. Elles sont triées par ordre alphabétique, cherchez 'Caption' elle devrait afficher la valeur 'Button1'. Cliquez dessus et changez 'Button1' en 'Press'. Si vous appuyez sur la touche ENTREE de votre clavier ou cliquez ailleurs, vous verrez le libellé de votre premier bouton de 'Form1' se changer en 'Press'. Ensuite cliquez sur l'onglet 'Événements' de l'inspecteur d'objet, pour voir les différents événements pouvant être associés au bouton. Cela inclut OnClick, OnEnter, OnExit etc. À présent, cliquez sur le bouton à droite de 'OnClick' [...]. Lorsque vous le sélectionnez, vous êtes renvoyés automatiquement dans l'éditeur de source, et votre curseur directement à l'emplacement où le code doit être saisi :

  procedure TForm1.Button1Click(Sender: TObject);
  begin
    {maintenant tapez :}    Button1.caption := 'Press again';
    {L'éditeur a déjà complété la procédure }
  end;

Appuyez sur F12 pour sélectionner Form1 au lieu de l'éditeur de source.

Maintenant, éditez les propriétés de 'Button2' : cliquez sur 'Button2' pour afficher ses propriétés dans l'inspecteur d'objet. Changez la propriété 'Caption' en 'Exit' au lieu de 'Button2'. Maintenant, sélectionnez l'onglet 'Événements', et cliquez sur 'OnClick'. Cliquez ensuite sur le bouton figurant 3 points [...], une nouvelle procédure sera automatiquement déclarée et le curseur sera positionné directement dans le corps de celle-ci :

  procedure TForm1.Button2Click(Sender: TObject);
  begin
  {maintenant tapez :}   Close;
  {L'éditeur a déjà complété la procédure } 
  end;

Maintenant, appuyez sur F12 pour revoir la fenêtre 'Form1'. Vous êtes maintenant prêt à compiler votre programme. La méthode la plus simple est de sélectionner 'Exécuter' dans le menu principal en haut de l'écran, et l'option 'Exécuter' dans le sous menu. Vous pouvez aussi appuyer, tout simplement, sur la touche F9 de votre clavier. Cette manipulation compilera votre programme, et (si tout se passe bien) l'exécutera.

La fenêtre de texte en dessous de l'éditeur de source affichera différentes sortes d'informations sur la compilation (information, alerte, erreur...). Quelques instant plus tard, 'Form1' va réapparaître, mais sans la grille de points qui permet de positionner les composants (boutons, zones de saisie) en mode conception. C'est le fenêtre principale de votre application, elle attend que vous cliquiez sur le bouton 'Press'.

Essayez de cliquer sur le bouton 'Press'. Le libellé changera en 'Press again'. Si vous cliquez encore, le libellé continuera à afficher 'Press again' !

Maintenant, cliquez sur le bouton marqué 'Exit'. La fenêtre se fermera et vous quitterez le programme. La fenêtre 'Form1' originale réapparaîtra en mode conception avec sa grille de points, prête à être modifiée de nouveau.

A présent, vous devriez sauvegarder votre travail (faites-le souvent !) sélectionnez : Projet -> Enregistrer le projet sous... et indiquez les noms de vos fichiers.

ATTENTION : le nom de fichier de la "Unit" et du projet doivent être différents.

Deuxième session

Rouvrez votre projet. Cliquez sur le bouton 'Press' (Button1) de la fenêtre 'Form1'. Sélectionnez l'onglet 'Évènements' dans l'inspecteur d'objet, cliquez sur le bouton près de 'OnClick' [...], pour retourner à l'emplacement approprié dans l'éditeur de source.

Modifiez votre code de la manière suivante :

  procedure TForm1.Button1Click(Sender: TObject);
 {Makes use of the Tag property, setting it to either 0 or 1}
  begin
    if Button1.tag = 0 then
    begin
      Button1.caption := 'Press again';
      Button1.tag := 1
    end else
    begin
      Button1.caption := 'Press';
      Button1.tag := 0
    end
  end;

Sauvegardez votre travail, et compilez votre programme. Le bouton 'Press' basculera entre les deux messages ('Press' et 'Press again').

Le reste dépend de vous !

Si vous préférez programmer en mode console (ou mode texte), par exemple si vous apprenez les bases du Pascal, ou que vous ayez besoin d'un programme de traitement par lots (batch) ou encore que vous souhaitiez faire de la programmation système, vous pouvez conserver Lazarus pour éditer, compiler et exécuter votre programme. Il constitue un environnement idéal pour le développement en Pascal. Voir Console Mode Pascal.

L'éditeur

Lorsque vous lancez Lazarus, une série de fenêtres flottantes apparaît.

La fenêtre principale en haut de l'écran est titrée Editeur Lazarus vXXXXXX - project1 (les X correspondent au numéro de la version de Lazarus installée sur votre machine). C'est une fenêtre importante de votre projet, elle contient le menu principal et la palette de composants.

Lazmainfr.jpg

Sur la ligne juste en dessous du titre se trouve le "Menu principal" avec les entrées habituelles : Fichier, Edition, Chercher, Voir... et d'autres qui correspondent à des fonctions spécifiques à Lazarus. En dessous à gauche vous trouverez un jeu de "BitButtons" qui vous permettrons d'accéder aux fonctions les plus courantes. A droite se trouve la palette de composants.

En dessous de la fenêtre de l'éditeur apparaît, à gauche de l'écran, la fenêtre de l'inspecteur d'objet, et l'éditeur de source de Lazarus. Il peut également y avoir une fenêtre plus petite, appelée Form1, recouvrant l'éditeur de source de Lazarus. Si 'Form1' n'est pas visible immédiatement, vous pouvez la faire apparaître en pressant F12, qui basculera de l'éditeur de source au formulaire correspondant à l'unité en cours, et inversement. La fenêtre de conception de formulaire et l'un des outils que vous utiliserez le plus fréquemment pour mettre en place une interface utilisateur pour votre application. Ce qu'il est possible de faire dans l'inspecteur d'objet est décrit plus en détail dans la section : Palette de composants.

Lorsque vous démarrez un nouveau projet, ou que vous lancez Lazarus pour la première fois, un formulaire par défaut apparaît. Ce formulaire consiste en une "boîte" contenant une grille de points qui vous aiderons à positionner les différents composants, une barre au sommet de la fenêtre contient les boutons habituels Réduire, Agrandir et Fermer. Si vous cliquez avec le curseur de la souris à l'endroit que vous voulez dans la boîte, vous verrez les propriétés du formulaire s'afficher dans l'inspecteur d'objet à gauche de l'écran.

D'autres fenêtres peuvent êtres affichées pendant votre travail : l'inspecteur de projet contient les détails des fichiers inclus dans votre projet, et vous permet également d'en rajouter ou d'en supprimer. La fenêtre de Messages, affiche les informations de compilation, les erreurs ou les rapports d'avancement ; si Lazarus est lancé depuis une fenêtre de terminal, le terminal original reste toujours visible et affiche également des messages de compilation.


Menu principal

Le menu principal contient les entrées suivantes : Fichier Edition Cercher Voir Project Exécuter Composants Outils Configuration Fenêtres Aide

Comme d'habitude, les options peuvent êtres sélectionnées soit en cliquant directement dessus à l'aide du bouton gauche de la souris, soit en tapant au clavier : Alt, la lettre correspondante au menu voulu (par exemple F), Entrée.

Pour plus de détails consultez Main menu/fr.

La barre de boutons

C'est une barre d'outil à gauche de la fenêtre d'édition principale, juste au-dessous du menu principal et à gauche de la palette de composants, elle contient un jeu de boutons appelant les fonctions les plus fréquemment utilisées dans le menu :

Nouvelle unité, Ouvrir (avec une flèche pointant vers le bas, affichant une liste des fichiers récemment utilisés), Enregistrer, Tout enregistrer, Nouvelle fiche, Commutation Fiche/Unité (i.e. affiche la fiche ou le code source de l'unité), Afficher les unités, Afficher les fiches, Exécuter (i.e. compile et exécute), Pause, Pas à pas approfondi, Pas à pas (les deux derniers sont des fonctions de débogage).

La palette de composants

La barre d'outils à onglets affiche un large choix d'icônes représentant les composants les plus courants pour la conception de formulaires.

Chaque onglet affiche un jeu d'icônes, correspondant aux fonctionnalités du groupe de composants. L'icône la plus à gauche, figurant une flèche, est appelée outil de sélection.

Si vous placez le pointeur de la souris sur l'une des icônes sans cliquer dessus, sont nom s'affichera. Notez que chaque nom commence par un 'T', ce qui signifie 'Type' ou plus précisément 'Class' de composant. Lorsque vous sélectionnez un composant pour l'intégrer dans un formulaire, la classe est ajoutée dans la section type de la partie interface de l'unité (habituellement en tant que partie de TForm1), et une instance de cette classe est ajoutée dans la section var (habituellement de la même manière que la variable Form1). Chaque méthode que vous écrivez pour être utilisée par le formulaire ou ses composants (i.e. Procédures ou Fonctions) sera placée dans la partie implementation de l'unité.

Dans la liste suivante, vous trouverez des liens vers les fichiers qui contiennent la description de ses composants. Si vous souhaitez trouver les propriétés d'un composant en particulier, il peut être utile d'étudier le composant duquel il est dérivé (son parent). Par exemple, pour comprendre TMaskEdit, il est également utile d'examiner TCustomMaskEdit.

ONGLETS (les noms sont largement explicites) :

  • Standard
Component Palette Standart.png
Les composants fréquemment utilisés :
TMainMenu, TPopupMenu, TButton, TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox, TRadioGroup, TCheckGroup, TPanel, TActionList
  • Additional
Component Palette Additional.png
Des composants souvent utilisés en complément :
TBitBtn, TSpeedButton, TStaticText, TImage, TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, TCheckListBox, TScrollBox, TApplicationProperties, TStringGrid, TDrawGrid, TPairSplitter, TColorBox, TColorListBox, TChart
  • Common Controls
Component Palette Common Controls.png
TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TTabControl, THeaderControl, TImageList
  • Dialogs
Component Palette Dialogs.png
TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TfindDialog, TReplaceDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog, TPrinterSetupDialog, TPrintDialog, TPageSetupDialog

Beaucoup de procédures ou de fonctions utiles comme les boîtes de dialogue n'apparaissent pas directement dans la palette de composants, mais peuvent être facilement appelées dans le code source du programme.

Pour quelques bons exemples sur l'utilisation des composants, voir le sous-répertoire $LazarusPath/lazarus/examples de votre installation. Beaucoup de ces programmes montrent comment utiliser les boîtes de dialogue et d'autres composants directement sans utiliser l'EDI et la palette de composants, ou des définition de fichier séparés : tous les composants sont complets et explicitement définis dans le programme Pascal principal. D'autres exemples de programmes utilisent pleinement l'EDI.

Certains exemples ne fonctionnent pas immédiatement : vous pourriez avoir besoin de modifier les chemins et les permissions des fichiers des répertoires. Si vous souhaitez compiler quelques exemples, faites attention à avoir les permissions de lecture/écriture/exécution pour les fichiers et les répertoires, ou copiez les fichiers dans un répertoire sur lequel vous avez les permissions appropriées.

Essayez d'exécuter le programme 'testall' pour voir un menu des composants disponibles ainsi que de petits exemples de formulaires de test pour la plupart d'entre eux ; ensuite inspectez le code pour comprendre comment ils fonctionnent !

  • Misc
Component Palette Misc.png
TColorButton, TSpinEdit, TFloatSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox, TXMLPropStorage, TIniPropStorage, TbarChart, TButtonPanel, TIDEDialogLayoutStorage
  • Data Controls
Component Palette DataControls.png
Composants orientés données, qui copient très largement les groupes Standard et Additionnel mais sont applicables aux bases de données : TDBNavigator, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
  • Data Access
Component Palette DataAccess.png
TDatasource, TMemDataset (Package MemDSLaz), TSdfDataSet (Package SDFLaz), TFixedFormatDataSet (Package SDFLaz), TDbf (Package DBFLaz)
  • System
Component Palette System.png
TTimer, TIdleTimer, TLazComponentQueue, THTMLHelpDatabase, THTMLBrowserHelpViewer, TProcess, TSimpleIPCClient, TSimpleIPCServer, TXMLConfig
  • SynEdit
Component Palette SynEdit.png
Un groupe de composants pour aider à interfacer d'autres langage et outils logiciels. SynEdit est un puissant composant d'édition multiligne, pour Borland Delphi, Kylix et C++ Builder. Il supporte la coloration syntaxique et la complétion de code, et il inclut l'export aux formats html, tex et rtf. C'est un contrôle VCL/CLX à part entière, ce qui signifie qu'il n'encapsule pas un contrôle Microsoft Windows, et qu'aucune bibliothèque d'exécution n'est requise ; cela fait de SynEdit un composant multi-plateforme. La compatiblité avec FreePascal est également prévue, et SynEdit est le composant d'édition dans l'EDI Lazarus. voir synedit sur sourceforge.
TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynAnySyn, TSynMultiSyn

Comment utiliser la Palette

Pour utiliser une palette, il faut afficher une fiche dans l'éditeur (s'il n'y en a pas, sélectionnez Fichier -> Nouvelle fiche). Cliquez sur l'icône du composant que vous souhaitez utiliser dans l'onglet approprié de la palette, et cliquez sur la fiche, vous verrez le composant apparaître. À ce moment là, vous pourrez le sélectionner à l'aide de la souris, et le déplacer à l'endroit que vous souhaitez sur la fiche et ajuster sa taille. Les ajustements peuvent être effectués directement sur l'image du composant sur la fiche ou en modifiant ses propriétés dans l'éditeur d'objet.

Si vous installez des composants additionnels, que ce soit des composants que vous avez vous-même écrits, ou des paquets provenant d'autre sources, de nouveaux onglets apparaîtront dans la palette de composants. Ces nouveaux composants peuvent être sélectionnés et utilisés sur vos fiches de la même manière que ceux fournis par défaut.

Comment utiliser les contrôles Standard, Common et étendus

Les Unités StdCtrls, ComCtrls et ExtCtrls contiennent les définitions et les descriptions de beaucoup des contrôles les plus fréquemment utilisés pour la construction de fiches et d'autres objets dans les applications Lazarus.

De nombreux contrôles finaux utilisés par les développeurs, tels que TButton, TMemo, TScrollBar etc., correspondent à une classe ancêtre comme, respectivement, TCustomButton, TCustomMemo ou TCustomScrollBar. Plusieurs propriétés et méthodes relatives au contrôle final sont définies (et expliquées) plus complètement dans la classe TCustomXXX, le contrôle final en héritant.

Si vous déposez un composant dans l'éditeur de fiche, vous n'avez pas besoin d'ajouter de code pour le créer. Le composant est automatiquement généré par l'EDI, ainsi que la fiche, et détruit lorsque la fiche est détruite.

Cependant, si vous créez un composant vous-même par programmation, n'oubliez pas de le libérer lorsqu'il n'est plus utilisé.

Si vous placez un composant dans l'éditeur de fiche et que vous regardez dans l'inspecteur d'objets, vous pourrez observer les propriétés changer en même temps que vous déplacez le composant.

Par exemple placez un bouton (TButton) sur le formulaire, cliquez dessus pour le sélectionner, puis déplacez-le avec la souris. Vous verrez alors les valeurs Top et Left changer au fur et à mesure dans l'inspecteur d'objets pour refléter sa position. Si vous utilisez les poignées de redimensionnement du bouton pour modifier sa taille, vous verrrez les propriétés Height et Width changer de la même façon.

Inversement, vous pouvez saisir dans l'inspecteur d'objets une valeur associée à une propriété, par exemple la hauteur (Height); vous verrez la taille de l'objet sur le formulaire changer pour correspondre à cette valeur.

You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example

         Form1.Button1.Height := 48;

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

En résumé, il existe généralement trois méthodes différentes pour déterminer chaque propriété d'un objet:

  • en utilisant la souris ;
  • en définissant les valeurs dans l'inspecteur d'objets;
  • ou explicitement en écrivant du code.

La plupart des composants définis dans ces unités ont plusieurs propriétés communes ; d'autres sont spécifiques aux composants individuels. Nous décrirons ici les plus courantes. Des propriétés inhabituelles ou spécifiques à un contrôle seront décrites pour les contrôles individuels.

De l'aide peut être obtenue en sélectionnant une propriété ou un mot clé, (dans l'inspecteur d'objet ou dans l'éditeur de source), puis en pressant F1. La page correspondante s'ouvrira alors.

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

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

Destructors: 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.

Take the following precautions when creating your own Destroy method:

  • Declare Destroy with the override directive, because it is a virtual method.
  • Always call 'inherited Destroy;' as the last thing on the destructor code.
  • 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.
  • Remember to call Free for all objects created on the constructor.


Some commonly listed properties
PropertyMeaning
Action The main action or event associated with the object. For example selecting an 'Exit' Button might cause the 'Close' action
Align Defines 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)
Anchor 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.
AutoSelect When True, an editing control will select all its text when it receives focus or when the Enter key is pressed.
AutoSelected True 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.
BorderSpacing The space around the edge between an Anchored control and its parent.
Caption The 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.
CharCase Indicates 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
Constraints Sets 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.
Color The Colour to be used to draw the control or to write the text it contains.
Enabled 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.
Font The 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.
Hint A short piece of informative pop-up text that appears if the mouse-cursor hovers over the control.
Items The 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
Lines An 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]
Name The 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.
PopUpMenu A window containing context-sensitive menu information that pops up when the right mouse button is clicked on the object.
Position (or Top, Left) Determines where the control is located on the parent form or window
ReadOnly Boolean 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.
ShowHint Allows a small window containing a context-sensitive Help or other description to be displayed when the mouse cursor 'hovers' over the control.
Size (or Height and Width) The dimensions of the control
Style The options available for Style depend upon the sort of Control being considered: for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc.
TabOrder Integer defining where in the sequence of tabs on the Form this control is to lie
TabStop Boolean property which if True places this control in the sequence of objects that the user can reach by successively pressing the Tab key
Text 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.
Visible If true, the object can be seen on the Form; if False, object is hidden
WordWrap Logical 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.

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

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

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

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.


Some commonly listed Actions
Action Meaning
OnChange Action to be taken if any change is detected (eg mouse move, mouse click, key press, edit text, alter picture, etc)
OnClick Action 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.
Click A 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.
OnDragDrop Action 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.
OnEntry Action 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.
OnExit Action to be taken when the mouse moves out of the area of the object, usually transferring focus out of the object.
OnKeyPress Action 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.
OnKeyDown Action 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.
On Key Up Action to be taken if a key is up (ie not pressed) while focus is in this control.
OnMouseMove On Mouse Down - Action to be taken if the mouse cursor moves while focus is in this control.
OnMouseDown Action to be taken if the mouse button is down while focus is in this control.
OnMouseUp Action 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.
OnResize Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc.

Comment utiliser les Menus

Trucs et astuces pour l'ajout de Menus dans vos Fiches.

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

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

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

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

Any or all of the MenuItems that you add can be configured using the Object Inspector.

At 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"

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.

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

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

Le débogueur

Reste encore à écrire.

voir également category: IDE Window - Debug

Les fichiers de Lazarus

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

Lorsque vous enregistrez, vous sauvez en réalité deux fichiers :

  xxx.pas et yyy.lpr 

(En fait en vous enregistrez plus que ça, mais ces deux-là sont les seuls auxquels vous donnez un nom). Le fichier de projet .lpr et le fichier d'unité .pas ne doivent pas avoir le même nom car Lazarus attribuera automatiquement à l'unité (dans le code source) le nom du fichier d'unité, et au programme, le nom du fichier de projet (sinon, le compilateur pourrait ne pas retrouver l'unité quand le fichier de projet y fera référence). Bien sûr, pour être cohérent, il change toute les occurrences de Unit1 en xxx.

Par conséquent, si vous enregistrez un fichier appelé encore, encore.pas et encore.lpr, la compilation échouera car les noms de l'unité et du programme sont les mêmes ce qui entraînera une erreur.

Les fichiers sont donc :

e:/lazarus/kj/lazhello

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

Note : il y a plus de fichiers que les deux que j'ai enregistrés.

Ci-dessous un bref commentaire sur chacun des fichiers :

encore.exe : l'exécutable du programme. Win32 ajoute l'extension .exe, mais pas Linux. Ce fichier sera très gros sous Linux à cause de l'inclusion des symboles de débogage (il est prévu de résoudre ce problème). Cependant, vous pouvez exécuter l'utilitaire "strip" pour supprimer ces symboles et réduire de façon substantielle la taille de l'exécutable.

encore.lpi : c'est le fichier principal d'un projet Lazarus (Lazarus Project Information) ; l'équivalent Delphi du fichier .dpr. Il est enregistré dans un dialecte XML et contient des instructions concernant toutes les bibliothèques et unités requises pour la compilation de l'exécutable.

encore.lpr : c'est le fichier source principal du programme ou fichier maître. En dépit du fait qu'il ait une extension spécifique à Lazarus, il s'agit en fait d'un fichier source Pascal parfaitement normal. Il possède une clause uses qui permet au compilateur de trouver toutes les unités nécessaires. Veuillez noter que le nom du programme et celui du fichier n'ont pas besoin d'être identiques. Ce fichier est habituellement plutôt petit, ne comportant que quelques assertions permettant d'initialiser et construire les fiches, et démarrer et terminer l'application. Le gros du travail est effectué dans les fichiers sources des unités, dont l'extension est '.pas'.

encoreu.lfm : c'est ici que Lazarus stocke les paramètres de la fiche (position, taille...), sous forme compréhensible. C'est le reflet des propriétés de divers composants, telles qu'elles apparaissent dans l'Inspecteur d'objet. Chaque description d'objet débute par une ligne :

object xxxx 
  suit une liste de propriétés y compris les objets encapsulés ou les sous-objets) puis la ligne
end

Lazarus utilise ce fichier pour générer la ressource incluse dans la section d'initialisation de l'unité encoreu.pas. Les fichiers .dfm de Delphi peuvent être convertis au format .lfm dans l'EDI de Lazarus en utilisant la commande Outils->Convertir un fichier DFM en fichier LFM....

encore.lrs : c'est le fichier de ressource qui contient les instructions permettant au programme de construire la fiche. Si vous regardez le fichier de l'unité principale, vous verrez dans la section d'initialisation la ligne

{$i againu.lrs}

qui commande au programme de charger le fichier de ressources. Notez que ce n'est pas un fichier de ressources Windows.

encoreu.pas : ce fichier d'unité contient votre code correspondant à cette fiche. C'est habituellement le seul fichier que le développeur a besoin d'éditer ou inspecter. Il contient tout le code spécifiquement ajouté par le développeur (en particulier, les 'event handlers').

encore.ppu : l'unité compilée. Elle est liée à l'exécutable, ainsi les autres unités citées dans la section Uses.

ppas.bat : c'est un simple script qui lie (link) le programme pour produire l'exécutable. Si la compilation réussit, il est effacé par le compilateur.

Contributeurs originaux et changements

Cette page a été importée de epikwiki.

  • 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