Sign in Join
Wiki copytemporary

Howto Use TSaveDialog/fr: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11== Comment utiliser **TSaveDialog ==** ![](/wiki-images/e/e1/Tsavedialog.png)
22
33Guide rapide :
44
551\. Placer un composant **SaveDialog** sur une fiche (peu importe où puisqu'il ne sera pas visible).
66
77` `![`Component_Palette_Dialogs.png`](/wiki-images/7/72/Component_Palette_Dialogs.png)\
88` (Il s'agit du second composant en partant de la gauche sous `[[Dialogs tab]]`)`
99
10102\. Ajouter un composant **Memo** sur la fiche.
1111
12-<figure>
13-<img src="tmemo.png" title="tmemo.png" />
14-<figcaption>tmemo.png</figcaption>
15-</figure>
12+![](/wiki-images/1/1b/Tmemo.png)
1613
17143\. Ajouter un bouton sur la fiche.
1815
19-<figure>
20-<img src="tbutton.png" title="tbutton.png" />
21-<figcaption>tbutton.png</figcaption>
22-</figure>
16+![](/wiki-images/b/b2/Tbutton.png)
2317
2418L'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 :
2519
2620``` pascal
2721 procedure TForm1.Button1Click( Sender: TObject );
2822 begin
2923 if SaveDialog1.Execute then
3024 Memo1.Lines.SaveToFile( SaveDialog1.Filename );
3125 end;
3226```
3327
3428La 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.
3529
3630La propriété [[doc:lcl/dialogs/tfiledialog.filename.html|Filename]] retournera le nom du fichier choisi en incluant le lecteur et le chemin.
3731
3832## Voir aussi
3933
4034- [[Howto Use TOpenDialog/fr]]
4135- [[Dialogs tab]]
4236- [[Standard tab|TButton]]
4337- [[Standard tab|TMemo]]
4438
4539---
4640*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).*

Back to history