Page 1 of 1

OpenFileRequester with long filenames

Posted: Wed Jun 29, 2016 7:11 am
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.

Re: OpenFileRequester with long filenames

Posted: Wed Jun 29, 2016 9:59 am
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.

Re: OpenFileRequester with long filenames

Posted: Wed Jun 29, 2016 10:21 am
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)

Re: OpenFileRequester with long filenames

Posted: Wed Jun 29, 2016 7:30 pm
by Little John

Re: OpenFileRequester with long filenames

Posted: Thu Jun 30, 2016 12:30 am
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).