Recent

Author Topic: Issue with Win32 TSaveDialog.DefaultExt  (Read 5762 times)

wp

  • Hero Member
  • *****
  • Posts: 12274
Re: Issue with Win32 TSaveDialog.DefaultExt
« Reply #30 on: August 21, 2023, 10:33:43 pm »
But since Laz/main breaks here compatibility with prior versions and with Delphi, I think this change should be reverted.
I strongly disagree.
I disagree with the disagree...

I think that following an unclear and partially wrong documentation is not reason enough to break existing Lazarus code and compatibility with delphi.

Bart

  • Hero Member
  • *****
  • Posts: 5335
    • Bart en Mariska's Webstek
Re: Issue with Win32 TSaveDialog.DefaultExt
« Reply #31 on: August 21, 2023, 11:19:32 pm »
Neither is following their bugs.
FOS_STRICTFILETYPES just is absolutely not the same as ofExtensionDifferent (and also not quite the same as not ofExtensionDifferent as well, but that at least is less wrong than the first one).

W.r.t. to ofExtensionDifferent in non-Vista dialogs.
I tested with D7, and the behaviour indeed seems to be that the flag is set if the extension Filename is not the same as DefaultExt (and if DefaultExt is empty, Filename must not have an extension in order to not have the flag set.

This is AFAICS completely not how we have implemented it...

MS Docs about OFN_EXTENSIONDIFFERENT state:
Quote
The user typed a file name extension that differs from the extension specified by lpstrDefExt. The function does not use this flag if lpstrDefExt is NULL.

So, it should not be set at all if DefaultExt is empty string (but D7 does).

About the warning in Delphi docs: "If you use this flag in an application, remember to reset it."
I tested that as well in D7: set the flag, select a filename with the default extension and the flag is unset, so that warning seems to make no sense.

The fact that this hasn't lead to any bugreports makes me wonder if anyone actually cares about how this works at all.

Bart

 

TinyPortal © 2005-2018