Difference between revisions of "TShellListView/fr"

From Lazarus wiki
Jump to navigationJump to search
Line 3: Line 3:
 
   * * * A FINIR  * * *
 
   * * * A FINIR  * * *
  
{{Note|This documentation is not intended to be thorough, but it is enough to get a beginner started on the use of the object. This particular discussion is biased to MS-Windows, and particularly Windows 7. At any-rate, its functionality appears to be OS-Specific, and care must be taken when porting code using this object to another OS.
+
{{Note|Cette documentation n'est pas destinée à être approfondie, mais il suffit pour commencer à un débutant sur l'utilisation de l'objet. Cette discussion particulière est basée à MS-Windows, et en particulier à Windows 7. À tout niveau, sa fonctionnalité semble être spécifique au système d'exploitation, et il faut prendre soin de transférer le code à l'aide de cet objet vers un autre système d'exploitation.
  
The default behavior appears to be to list only filenames. While the behavior can be made to be Explorer-like, icons do not appear by default.
+
Le comportement par défaut semble lister uniquement les noms de fichiers. Bien que le comportement puisse être fait pour être comme l'Explorateur de fichiers, les icônes ne s'affichent pas par défaut.}}
}}
 
  
'''TShellListView''' [[image:tshelllistview.png]] displays files according to its Root property. The Root property contains the whole path from the drive letter to the current directory. If using it to show the complete path including a selected file, then you need to append a slash ('\' or '/' in UNIX) to Root, as in:
+
'''TShellListView''' [[image:tshelllistview.png]] affiche des fichiers selon sa propriété Root. Celle-ci contient le chemin d'accès complet depuis le lettre de lecteur jusqu'au dossier courant. {{ComponentTab/fr|TShellListView|Misc}}.
  
<code>
+
Si vous l'utilisez pour afficher le chemin complet incluant un fichier sélectionné, vous devez ajouter une barre oblique ('\' ou '/' dans UNIX) à Root, comme dans :
 +
<syntaxhighlight>
 
pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';
 
pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';
</code>
+
</syntaxhighlight>
  
where <code>svList</code> is the name of a TShellListView object, and <code>svList.Selected.Caption</code> contains the name of a file selected by the user. <code>pathname</code> is a string variable containing the entire path from the drive letter to the file name and extension. The double quotes are recommended to be applied in MS-Windows if the path contains spaces. This makes the usual process of escaping spaces in filenames with <code>%20</code> unnecessary in Windows.
+
<code>svList</code> est le nom de l'objet TShellListView, et <code>svList.Selected.Caption</code> contient le nom du fichier sélectionné par l'utilisateur. <code>pathname</code> est une variable chaîne contenant le chemin entier de la lettre de lecteur au nom de fichier et son extension. Il est recommandé d'appliquer les guillemets dans MS-Windows si le chemin contient des espaces. Cela rend le processus habituel d'échapper les espaces avec des <code>%20</code> inutile dans Windows.
  
 
== Parler avec TShellTreeView ==
 
== Parler avec TShellTreeView ==
Line 52: Line 52:
 
When running a program with this object, you may notice that double-clicking on a filename will allow you to edit it or delete its name entirely by default. These sorts of changes appear to have no effect on the file itself. To stop this behavior, set the ReadOnly property to True.
 
When running a program with this object, you may notice that double-clicking on a filename will allow you to edit it or delete its name entirely by default. These sorts of changes appear to have no effect on the file itself. To stop this behavior, set the ReadOnly property to True.
  
{{LCL Components}}
+
{{LCL Components/fr}}

Revision as of 06:45, 6 October 2017

English (en) français (fr)

 * * * A FINIR  * * *

Light bulb  Remarque: Cette documentation n'est pas destinée à être approfondie, mais il suffit pour commencer à un débutant sur l'utilisation de l'objet. Cette discussion particulière est basée à MS-Windows, et en particulier à Windows 7. À tout niveau, sa fonctionnalité semble être spécifique au système d'exploitation, et il faut prendre soin de transférer le code à l'aide de cet objet vers un autre système d'exploitation.

Le comportement par défaut semble lister uniquement les noms de fichiers. Bien que le comportement puisse être fait pour être comme l'Explorateur de fichiers, les icônes ne s'affichent pas par défaut.

TShellListView tshelllistview.png affiche des fichiers selon sa propriété Root. Celle-ci contient le chemin d'accès complet depuis le lettre de lecteur jusqu'au dossier courant. Le composant TShellListView est disponible depuis l'onglet Misc de la palette de composants.

Si vous l'utilisez pour afficher le chemin complet incluant un fichier sélectionné, vous devez ajouter une barre oblique ('\' ou '/' dans UNIX) à Root, comme dans :

pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';

svList est le nom de l'objet TShellListView, et svList.Selected.Caption contient le nom du fichier sélectionné par l'utilisateur. pathname est une variable chaîne contenant le chemin entier de la lettre de lecteur au nom de fichier et son extension. Il est recommandé d'appliquer les guillemets dans MS-Windows si le chemin contient des espaces. Cela rend le processus habituel d'échapper les espaces avec des %20 inutile dans Windows.

Parler avec TShellTreeView

There is little coding to do in getting TShellListView to communicate with TShellTreeView. In the Object Inspector, under the Events tab, for TShellTreeView, set the event "ShellListView" to the name of your TShellListView object. This ought to be already stored on a dropdown menu if both TShellListView and TShellTreeView objects are deployed on your form. For completeness, so that both objects respond to each other, set the ShellTreeView event of TShellListView to the name of your TShellTreeView object.

Alternatively, if we let svList be the TShellListView object; and svTree be the TShellTreeView object, then these properties can be set programmatically:

    svList.ShellTreeView := svTree;
    svTree.ShellListView := svList;

The result is to invoke Explorer-like behavior in their responsiveness.

Ouverture de documents

In Windows, the generic command for opening a file in TShellListView is OpenDocument(pathname), where pathname is the path to the file. For this you should remember to add lclintf to your uses clause. Other operating systems can get away with using OpenURL(pathname), except that spaces must be escaped with a %20 string, and file:// must prepend the pathname. Example:

   OpenURL('file:///home/joe/text/foo%20bar.txt');

Contrast this with the Windows convention:

   OpenDocument("C:\Users\Joe\My Documents\xyz.txt");

OpenURL is not recommended for use in Windows for opening documents using the file:// URI scheme.

Because OpenDocument also acts as a Boolean function, it returns false if there is no way in the registry to open the file. If we let pathname be the full path to the file from the drive letter to the filename, this statement will open the document if OpenDocument(pathname) returns True:

 if not OpenDocument(pathname) then  // no method to display this file type
    ShowMessage('Cannot display ' + pathname);

Faire face à l'étrangeté

When running a program with this object, you may notice that double-clicking on a filename will allow you to edit it or delete its name entirely by default. These sorts of changes appear to have no effect on the file itself. To stop this behavior, set the ReadOnly property to True.


Composant LCL
Onglet de palette Composants
Standard TMainMenu • TPopupMenu • TButton • TLabel • TEdit • TMemo • TToggleBox • TCheckBox • TRadioButton • TListBox • TComboBox • TScrollBar • TGroupBox • TRadioGroup • TCheckGroup • TPanel • TFrame • TActionList
Additional TBitBtn • TSpeedButton • TStaticText • TImage • TShape • TBevel • TPaintBox • TNotebook • TLabeledEdit • TSplitter • TTrayIcon • TControlBar • TFlowPanel • TMaskEdit • TCheckListBox • TScrollBox • TApplicationProperties • TStringGrid • TDrawGrid • TPairSplitter • TColorBox • TColorListBox • TValueListEditor
Common Controls TTrackBar • TProgressBar • TTreeView • TListView • TStatusBar • TToolBar • TCoolBar • TUpDown • TPageControl • TTabControl • THeaderControl • TImageList • TPopupNotifier • TDateTimePicker
Dialogs TOpenDialog • TSaveDialog • TSelectDirectoryDialog • TColorDialog • TFontDialog • TFindDialog • TReplaceDialog • TOpenPictureDialog • TSavePictureDialog • TCalendarDialog • TCalculatorDialog • TPrinterSetupDialog • TPrintDialog • TPageSetupDialog • TTaskDialog
Data Controls TDBNavigator • TDBText • TDBEdit • TDBMemo • TDBImage • TDBListBox • TDBLookupListBox • TDBComboBox • TDBLookupComboBox • TDBCheckBox • TDBRadioGroup • TDBCalendar • TDBGroupBox • TDBGrid • TDBDateTimePicker
Data Access TDataSource • TBufDataset • TMemDataset • TSdfDataSet • TFixedFormatDataSet • TDbf
System TTimer • TIdleTimer • TLazComponentQueue • THTMLHelpDatabase • THTMLBrowserHelpViewer • TAsyncProcess • TProcessUTF8 • TProcess • TSimpleIPCClient • TSimpleIPCServer • TXMLConfig • TEventLog • TServiceManager • TCHMHelpDatabase • TLHelpConnector
Misc TColorButton • TSpinEdit • TFloatSpinEdit • TArrow • TCalendar • TEditButton • TFileNameEdit • TDirectoryEdit • TDateEdit • TTimeEdit • TCalcEdit • TFileListBox • TFilterComboBox • TComboBoxEx • TCheckComboBox • TButtonPanel • TShellTreeView • TShellListView • TXMLPropStorage • TINIPropStorage • TIDEDialogLayoutStorage • TMRUManager • TStrHolder
LazControls TCheckBoxThemed • TDividerBevel • TExtendedNotebook • TListFilterEdit • TListViewFilterEdit • TTreeFilterEdit • TShortPathEdit • TLvlGraphControl
RTTI TTIEdit • TTIComboBox • TTIButton • TTICheckBox • TTILabel • TTIGroupBox • TTIRadioGroup • TTICheckGroup • TTICheckListBox • TTIListBox • TTIMemo • TTICalendar • TTIImage • TTIFloatSpinEdit • TTISpinEdit • TTITrackBar • TTIProgressBar • TTIMaskEdit • TTIColorButton • TMultiPropertyLink • TTIPropertyGrid • TTIGrid
SQLdb TSQLQuery • TSQLTransaction • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TSQLite3Connection • TIBConnection • TFBAdmin • TFBEventMonitor • TSQLDBLibraryLoader
Pascal Script TPSScript • TPSScriptDebugger • TPSDllPlugin • TPSImport_Classes • TPSImport_DateUtils • TPSImport_ComObj • TPSImport_DB • TPSImport_Forms • TPSImport_Controls • TPSImport_StdCtrls • TPSCustomPlugin
SynEdit TSynEdit • TSynCompletion • TSynAutoComplete • TSynMacroRecorder • TSynExporterHTML • TSynPluginSyncroEdit • TSynPasSyn • TSynFreePascalSyn • TSynCppSyn • TSynJavaSyn • TSynPerlSyn • TSynHTMLSyn • TSynXMLSyn • TSynLFMSyn • TSynDiffSyn • TSynUNIXShellScriptSyn • TSynCssSyn • TSynPHPSyn • TSynTeXSyn • TSynSQLSyn • TSynPythonSyn • TSynVBSyn • TSynAnySyn • TSynMultiSyn • TSynBatSyn • TSynIniSyn • TSynPoSyn
Chart TChart • TListChartSource • TRandomChartSource • TUserDefinedChartSource • TCalculatedChartSource • TDbChartSource • TChartToolset • TChartAxisTransformations • TChartStyles • TChartLegendPanel • TChartNavScrollBar • TChartNavPanel • TIntervalChartSource • TDateTimeIntervalChartSource • TChartListBox • TChartExtentLink • TChartImageList
IPro TIpFileDataProvider • TIpHttpDataProvider • TIpHtmlPanel