Howto Use TSaveDialog/fr: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | == Comment utiliser **TSaveDialog ==**  | |
| 2 | 2 | ||
| 3 | 3 | Guide rapide : | |
| 4 | 4 | ||
| 5 | 5 | 1\. Placer un composant **SaveDialog** sur une fiche (peu importe où puisqu'il ne sera pas visible). | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | - | ||
| 7 | + | ```text | |
| 8 | + | Image:Component_Palette_Dialogs.png | |
| 9 | + | (Il s'agit du second composant en partant de la gauche sous Dialogs tab) | |
| 10 | + | ``` | |
| 9 | 11 | ||
| 10 | 12 | 2\. Ajouter un composant **Memo** sur la fiche. | |
| 11 | 13 | ||
| 12 | 14 |  | |
| 13 | 15 | ||
| 14 | 16 | 3\. Ajouter un bouton sur la fiche. | |
| 15 | 17 | ||
| 16 | 18 |  | |
| 17 | 19 | ||
| 18 | 20 | L'inspecteur d'objet affichera les propriétés du bouton **Button1**. Modifier la propriété nommée **Caption** : de **Button1**, la passer à **Enregistrer**. Cliquer sur le panneau **Événements** de l'inspecteur d'objet. Cliquer à droite de **OnClick** : une petite boîte comprenant trois points apparaît. Cliquer sur cette petite boîte qui conduit directement dans l'éditeur de source, plaçant au passage le curseur au début d'une portion de code ajoutée automatiquement. Compléter ainsi le code : | |
| 19 | 21 | ||
| 20 | 22 | ``` pascal | |
| 21 | 23 | procedure TForm1.Button1Click( Sender: TObject ); | |
| 22 | 24 | begin | |
| 23 | 25 | if SaveDialog1.Execute then | |
| 24 | 26 | Memo1.Lines.SaveToFile( SaveDialog1.Filename ); | |
| 25 | 27 | end; | |
| 26 | 28 | ``` | |
| 27 | 29 | ||
| 28 | 30 | La méthode [[doc:lcl/dialogs/tcommondialog.execute.html|Execute]] affichera la boîte de dialogue de choix d'un fichier. Elle retourne [[True/fr|true]] quand l'utilisateur a choisi un fichier et [[False/fr|false]] quand il a abandonné la procédure. | |
| 29 | 31 | ||
| 30 | 32 | La propriété [[doc:lcl/dialogs/tfiledialog.filename.html|Filename]] retournera le nom du fichier choisi en incluant le lecteur et le chemin. | |
| 31 | 33 | ||
| 32 | 34 | ## Voir aussi | |
| 33 | 35 | ||
| 34 | 36 | - [[Howto Use TOpenDialog/fr]] | |
| 35 | 37 | - [[Dialogs tab]] | |
| 36 | 38 | - [[Standard tab|TButton]] | |
| 37 | 39 | - [[Standard tab|TMemo]] | |
| 38 | 40 | ||
| 39 | 41 | --- | |
| 40 | 42 | *From the Free Pascal wiki, page "Howto Use TSaveDialog/fr", as it stood on 2020-02-17 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).* |
