-
September 13th, 2013, 08:07 AM
#1
CFileDialog doesn't display the file name correctly
I haven't seen this before but on Windows 7 Home Professional and VC 2012 in one particular app, a CFileDialog displays only the rightmost 11 characters plus the extension of the default file name. The rest of the name is there and you can scroll left in the file name edit to display it all, but initially the text is shifted left so it doesn't all display. Hope that makes sense.
This is the code.
Code:
CFileDialog dlg(TRUE, "csv", strFileName, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, "Comma Seperated Values Files (*.csv)|*.csv|All Files (*.*)|*.*||");
strFileName can contain anything and it will do it. Even a string literal will do it.
Any ideas?
-
September 13th, 2013, 08:55 PM
#2
Re: CFileDialog doesn't display the file name correctly
11 characters rings a bell for me: It's the length of a legacy "short" file name plus a legacy three-character extension. It would have looked even more logical to me if it were 12 characters rather than 11, accounting for the dot in the assumed legacy file name, still I suspect you're observing some long forgotten legacy code sneaking up from behind, somewhere in the framework/CRT or even Windows itself...
Of course this is just a shot in the dark, mostly driven by some gut feeling. It may still give you a hint into some direction to research, maybe just to eliminate that potential cause of the issue.
IOW, just my $.02 so to say...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
September 14th, 2013, 05:34 AM
#3
Re: CFileDialog doesn't display the file name correctly
Quite weird, that happens in "Vista-style" file open dialog.
If change the code...
Code:
CFileDialog dlg(TRUE, _T("csv"), strFileName, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY,
_T("Comma Seperated Values Files (*.csv)|*.csv|All Files (*.*)|*.*||"), this, 0, FALSE);
// ...
...in order to display the "legacy" open file dialog, that not happens anymore.
Well, if that's a real issue for you, then is time to say: Hey dudes, something is rotten in the state of Denmark!
-
September 16th, 2013, 01:38 AM
#4
Re: CFileDialog doesn't display the file name correctly
Originally Posted by GCDEF
I haven't seen this before but on Windows 7 Home Professional and VC 2012 in one particular app, a CFileDialog displays only the rightmost 11 characters plus the extension of the default file name. The rest of the name is there and you can scroll left in the file name edit to display it all, but initially the text is shifted left so it doesn't all display. Hope that makes sense.
I've seen this behavior before on my own dialogs where an edit box was the first control on the dialog to receive user input and it was resized dynamically. I think what happened was that the edit box first received input focus, so it selected all the text and set the cursor at the end, scrolling the text left. Then the edit box was resized, but the contents were not scrolled accordingly.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|