Difference between revisions of "TShellListView"
Line 9: | Line 9: | ||
<code>pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';</code> | <code>pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';</code> | ||
− | 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. 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. | + | 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. |
===Dealing with strangeness=== | ===Dealing with strangeness=== | ||
When runnning 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 behaviour, set the ReadOnly property to True. | When runnning 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 behaviour, set the ReadOnly property to True. |
Revision as of 14:52, 27 August 2013
Introduction
This documentation is not intended to be thorough, but it is enough to get a beginner started on the use of the object. Later on, there might be a more standardized treatment of this 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.
Managing TShellListView
TShellListView 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:
pathname := '"' + svList.Root + '\' + svList.Selected.Caption + '"';
where svList
is the name of a TShellListView object, and svList.Selected.Caption
contains the name of a file selected by the user. pathname
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 %20
unnecessary in Windows.
Dealing with strangeness
When runnning 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 behaviour, set the ReadOnly property to True.