Difference between revisions of "FCL/fr"

From Free Pascal wiki
Jump to navigationJump to search
m (Fixed syntax highlighting; deleted category included in page template)
 
(4 intermediate revisions by 3 users not shown)
Line 18: Line 18:
 
=== Documentation ===
 
=== Documentation ===
  
Currently, the FCL is not documented (feel free to contribute;
+
Actuellement la FCL n'est pas documentée (libre à vous de contribuer; voyez également sur [http://lazarus-ccr.sourceforge.net/docs/fcl/index.html Reference our la FCL]).
also take a look at [http://lazarus-ccr.sourceforge.net/docs/fcl/index.html Reference for 'fcl']).
+
Pour les unités compatibles Delphi, vous pouvez consulter la documentation de Delphi.
For Delphi compatible units, you could consult the Delphi documentation.
+
Vous pouvez toujours également jeter un oeil sur les fichiers source dans le  [http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/ dépôt de sources].
You can always take a look at the source files in the [http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/ source repository].
 
  
=== Example ===
+
=== Exemple ===
  
The following program illustrates the use of the class TObjectList in the FCL unit Contnrs (providing various containers, including lists, stacks, and queues):
+
Le programme suivant illustre l'utilisation de la classe TObjectList dans l'unité FCL Contnrs (qui offre divers conteneurs, incluant listes, piles et queues):
  
<delphi> program TObjectListExample;
+
<syntaxhighlight lang=pascal>
 +
program TObjectListExample;
 
   
 
   
 
  uses
 
  uses
   Classes, { from RTL for TObject }
+
   Classes, { de la RTL pour TObject }
   Contnrs; { from FCL for TObjectList }
+
   Contnrs; { de la FCL pour TObjectList }
 
   
 
   
 
  type
 
  type
     TMyObject = class(TObject)  { just some application-specific class }
+
     TMyObject = class(TObject)  { juste une classe spécifique à l'application }
 
     private
 
     private
       FName: String; { with a string field }
+
       FName: String; { avec un champ chaîne }
 
     public
 
     public
       constructor Create(AName: String); { and a constructor to create it with a given name }
+
       constructor Create(AName: String); { et un constructeur pour le créer avec un nom donné }
       property Name: String read FName; { and a property to read the name }
+
       property Name: String read FName; { et une proriété pour lire le nom }
 
   end;
 
   end;
 
   
 
   
Line 49: Line 49:
 
   
 
   
 
  var
 
  var
   VObjectList: TObjectList; { for a list of objects; it is a reference to such a list! }
+
   VObjectList: TObjectList; { pour une liste d'objets; il s'agit d'une référence à une telle liste! }
 
   
 
   
 
  begin
 
  begin
   VObjectList := TObjectList.Create  { create an empty list }
+
   VObjectList := TObjectList.Create  { crée une liste vide }
 
   with VObjectList do
 
   with VObjectList do
 
   begin
 
   begin
Line 60: Line 60:
 
     Writeln((Last as TMyObject).Name);
 
     Writeln((Last as TMyObject).Name);
 
   end;
 
   end;
  end.</delphi>
+
  end.</syntaxhighlight>
  
This program must be compiled in an object-oriented mode, such as -Mobjfpc or -Mdelphi.
+
Ce programme doit être compilé en momde orienté-objet, tel que -Mobjfpc ou -Mdelphi.

Latest revision as of 00:08, 15 February 2020

Deutsch (de) English (en) español (es) suomi (fi) français (fr) Bahasa Indonesia (id) 日本語 (ja) русский (ru) 中文(中国大陆)‎ (zh_CN)

The Free Component Library (FCL) consists of a collection of units, providing components (mostly classes) for common tasks. It intends to be compatible with Delphi's Visual Component Library (VCL), but the FCL is restricted to non-visual components. On the other hand, the FCL also goes beyond the VCL.

See Free Component Library for the current development status and an overview of the available components (though this seems inconsistent with Reference for 'fcl' in Lazarus). You can also check the source repository. Note that there are also some platform specific files in the FCL.

Usage

Pour utiliser un composant de la FCL, vous devez inclure son nom dans la clause uses de votre programme ou unité (voir l'exemple ci-dessous). La configuration par défaut du compilateur est reglée pour chercher le dossier de la FCL afin d'atteindre ces unités. Vous pouvez également régler le chemin approprié avec une option de la ligne de commande du compilateur de la forme -Fu<chemin-vers-les-unités-fcl>.

Documentation

Actuellement la FCL n'est pas documentée (libre à vous de contribuer; voyez également sur Reference our la FCL). Pour les unités compatibles Delphi, vous pouvez consulter la documentation de Delphi. Vous pouvez toujours également jeter un oeil sur les fichiers source dans le dépôt de sources.

Exemple

Le programme suivant illustre l'utilisation de la classe TObjectList dans l'unité FCL Contnrs (qui offre divers conteneurs, incluant listes, piles et queues):

 program TObjectListExample;
 
 uses
   Classes, { de la RTL pour TObject }
   Contnrs; { de la FCL pour TObjectList }
 
 type
    TMyObject = class(TObject)  { juste une classe spécifique à l'application }
    private
      FName: String; { avec un champ chaîne }
    public
      constructor Create(AName: String); { et un constructeur pour le créer avec un nom donné }
      property Name: String read FName; { et une proriété pour lire le nom }
   end;
 
 constructor TMyObject.Create(AName: String);
 begin
   inherited Create;
   FName := AName;
 end;
 
 var
   VObjectList: TObjectList; { pour une liste d'objets; il s'agit d'une référence à une telle liste! }
 
 begin
   VObjectList := TObjectList.Create  { crée une liste vide }
   with VObjectList do
   begin
     Add(TMyObject.Create('Thing One'));
     Writeln((Last as TMyObject).Name);
     Add(TMyObject.Create('Thing Two'));
     Writeln((Last as TMyObject).Name);
   end;
 end.

Ce programme doit être compilé en momde orienté-objet, tel que -Mobjfpc ou -Mdelphi.