FCL/fr: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: FCL/fr
| Old | New | Line | |
|---|---|---|---|
| 1 | + | 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. | |
| 2 | + | ||
| 3 | + | See [Free Component Library](http://www.freepascal.org/fcl/fcl.html) for the current development status and an overview of the available components (though this seems inconsistent with [Reference for 'fcl'](http://lazarus-ccr.sourceforge.net/docs/fcl/index.html) in Lazarus). You can also check the [source repository](http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/). Note that there are also some platform specific files in the FCL. | |
| 4 | + | ||
| 5 | + | ### Usage | |
| 6 | + | ||
| 7 | + | 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\>. | |
| 8 | + | ||
| 9 | + | ### Documentation | |
| 10 | + | ||
| 11 | + | Actuellement la FCL n'est pas documentée (libre à vous de contribuer; voyez également sur [Reference our la FCL](http://lazarus-ccr.sourceforge.net/docs/fcl/index.html)). 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](http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/). | |
| 12 | + | ||
| 13 | + | ### Exemple | |
| 14 | + | ||
| 15 | + | Le programme suivant illustre l'utilisation de la classe TObjectList dans l'unité FCL Contnrs (qui offre divers conteneurs, incluant listes, piles et queues): | |
| 16 | + | ||
| 17 | + | ``` pascal | |
| 18 | + | program TObjectListExample; | |
| 19 | + | ||
| 20 | + | uses | |
| 21 | + | Classes, { de la RTL pour TObject } | |
| 22 | + | Contnrs; { de la FCL pour TObjectList } | |
| 23 | + | ||
| 24 | + | type | |
| 25 | + | TMyObject = class(TObject) { juste une classe spécifique à l'application } | |
| 26 | + | private | |
| 27 | + | FName: String; { avec un champ chaîne } | |
| 28 | + | public | |
| 29 | + | constructor Create(AName: String); { et un constructeur pour le créer avec un nom donné } | |
| 30 | + | property Name: String read FName; { et une proriété pour lire le nom } | |
| 31 | + | end; | |
| 32 | + | ||
| 33 | + | constructor TMyObject.Create(AName: String); | |
| 34 | + | begin | |
| 35 | + | inherited Create; | |
| 36 | + | FName := AName; | |
| 37 | + | end; | |
| 38 | + | ||
| 39 | + | var | |
| 40 | + | VObjectList: TObjectList; { pour une liste d'objets; il s'agit d'une référence à une telle liste! } | |
| 41 | + | ||
| 42 | + | begin | |
| 43 | + | VObjectList := TObjectList.Create { crée une liste vide } | |
| 44 | + | with VObjectList do | |
| 45 | + | begin | |
| 46 | + | Add(TMyObject.Create('Thing One')); | |
| 47 | + | Writeln((Last as TMyObject).Name); | |
| 48 | + | Add(TMyObject.Create('Thing Two')); | |
| 49 | + | Writeln((Last as TMyObject).Name); | |
| 50 | + | end; | |
| 51 | + | end. | |
| 52 | + | ``` | |
| 53 | + | ||
| 54 | + | Ce programme doit être compilé en momde orienté-objet, tel que -Mobjfpc ou -Mdelphi. | |
| 55 | + | ||
| 56 | + | --- | |
| 57 | + | *From the Free Pascal wiki, page "FCL/fr", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
