Jump to content

[BUG] FileSaveDialog extension


MyEarth
 Share

Recommended Posts

1) You have created a FileSaveDialog with two choice, .txt and .au3

2) User write a whatever name ( noone write the extension in the filename ) and select .au3, the second choice of the combobox list

3) Now you can't do nothing because you don't know what is the filetype selected, how your Func() save the file? .au3 or .txt?

Strange that no one has noticed until now. With the new version of FileSaveDialog ( when Jon do it, if he do it ) we have in the returned value also extension ( now C:MYNAME became C:MYNAME.au3 ) so we save the file correctly, whatever is the user choice from the combobox

Edited by MyEarth
Link to comment
Share on other sites

  • Developers

Wonder if someone could explain whatever the problem is here.

I don't understand how you can select a file without an extension unless *.* is used in filter.

The issue is the following: when you just type in a filename "XYZ" without extension in the FileName field and you select in the  "Save as type"  the extension "*.au3", you would expect that the returned filename is equal to: "XYZ.au3" since you selected to use that extension.

This is currently not the case.

The resolution is simple by setting the .lpstrDefExt value in the OPENFILENAME structure to "".

See this page for details and this explanation:

 

lpstrDefExt

Type: LPCTSTR

The default extension. GetOpenFileName and GetSaveFileName append this extension to the file name if the user fails to type an extension. This string can be any length, but only the first three characters are appended. The string should not contain a period (.). If this member is NULL and the user fails to type an extension, no extension is appended.

 

All clear? :)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...