When I set the Filename property of a TFileOpenDialog and then execute it I see just the final 14 characters of the filename selected in the Filename field. If I press Home I can see that the entire string is there, but I'd like it to display properly of course. I've tested on two Windows 7 and one Windows 8 machine with the same results. Does anyone have any suggestions or hints on how to solve the issue?
FileOpenDialog1.FileName :=
'C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\available_downloads_en.htm';
if FileOpenDialog1.Execute then
ShowMessage(FileOpenDialog1.FileName);
Initial display showing problem:
The entire string after pressing Home:
From FileDialog. AddExtension Property: "Gets or sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension."
Step 1: Drag the OpenFileDialog control from the toolbox and drop it to the Windows form, as shown below. Step 2: Once the OpenFileDialog is added to the form, we can set various properties of the OpenFileDialog by clicking on the OpenFileDialog. Video Player is loading.
To create an OpenFileDialog control at design-time, you simply drag and drop an OpenFileDialog control from Toolbox to a Form in Visual Studio. After you drag and drop an OpenFileDialog on a Form, the OpenFileDialog looks like Figure 2. Adding an OpenFileDialog to a Form adds following two lines of code.
Windows. Forms. OpenFileDialog component opens the Windows dialog box for browsing and selecting files. To open and read the selected files, you can use the OpenFileDialog.
TFileOpenDialog
is just a thin wrapper around Microsoft's IFileDialog
interface on Windows Vista and later. You don't have control over how the dialog itself behaves when it is shown. If it only shows the last characters (and I was able to reproduce that behavior on my Win7 box), than that is simply how the dialog works in general. However, with that said, IFileDialog
does allow the absolute folder path and just the filename to be set separately, and that is how they should be used, but TFileOpenDialog
does not make or expose that separation, unfortunately (Embarcadero bug?). So if you need that functionality, you will have to use IFileDialog
directly and not use TFileOpenDialog
at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With