OpenFileRequester with long filenames

Windows specific forum
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

OpenFileRequester with long filenames

Post by ozzie »

When I call OpenFileRequester specifying a DefaultFile with a filename exceeding about 14 characters (or a displayed length of about 84 pixels) I only get the trailing part of the DefaultFile initially visible, for example:

Image

This is the result of this code:

Code: Select all

StandardFile$ = "C:\autoexecabcd.bat"
Pattern$ = "Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*"
Pattern = 0
File$ = OpenFileRequester("Please choose file to load", StandardFile$, Pattern$, Pattern)
which is based on the example given in the PB Help. The full filename in this example is autoexecabcd.bat. Much longer filenames are also limited to this initial visible display size.

Although the displayed and highlighted part of the filename is short, the complete filename is present and can be seen been clicking 'Home' when the cursor is on the field.

Is there a way to get the full file name visible on displaying the OpenFileRequester dialog? I get the same results with both x86 and x64 compiles under Windows 10, using PB 5.42 LTS.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: OpenFileRequester with long filenames

Post by IdeasVacuum »

Tested PB5.42LTS and PB5.31 x86 on Win7 x86, same result.

I think this is a bug - not sure if it is PB or Win API used by PB, would be good if somebody could test on a different OS.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: OpenFileRequester with long filenames

Post by Keya »

Its fine on my XP but i get the same "the start is chopped off" undesired effect on Win7 as youre seeing on Win10.

I dont think its a PB issue though because it seems to be just the standard Windows API being used to display that dialog (comdlg32's GetOpenFileName api it seems)
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: OpenFileRequester with long filenames

Post by Little John »

ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: OpenFileRequester with long filenames

Post by ozzie »

Thanks - I hadn't found that topic in my earlier searching. It seems to me that this whole issue is a hangover from the old days when MS-DOS only support 8.3 filenames (max 8 characters in the name and 3 characters in the extension).
Post Reply