What is the difference between the new TFileOpenDialog and the old TOpenDialog?

前端 未结 2 1700
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 07:43

What is the difference between the new TFileOpenDialog and the old TOpenDialog?
In my computer (Win 7/DXE), when I run the code, the dialogs look the same.

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 08:29

    TOpenDialog executes TFileOpenDialog when the following conditions are met:

    1. the program is running under Vista (and up)
    2. UseLatestCommonDialogs is true (which is the default)
    3. no OnIncludeItem, OnClose or OnShow events are set

    So while still using TOpenDialog on your system you may likely end up automagically executing TFileOpenDialog in most cases, which explains why they are looking the same for you.

    Remark: TFileOpenDialog does not fall back on older Windows systems (XP and under) - it just raises an exception. On the opposite, TOpenDialog does some sort of "fall forward".

提交回复
热议问题