Menu

#176 Allow to open non-existing files.

open
5
2004-08-25
2004-08-25
No

Current set of file dialogs in Tk provides only dialogs
for open of existing file and save to file with
confirmation of overwriting file.

This is enough to implement standard File menu in the
CUA compatible application, where New command and Open
command are distinct.

But uses of file dialogs are not limiting to opening
main document to work with. There are some auxiliary
files which names can be configured in configuration
dialog for example, and existense/non-existense of
these files can be handled programmaticaly more clever
way. At least user should be asked "File doesn't exist,
create one with default values" rather than "File
exist, it's ok to overwrite" if we deal with
configuration file.

In some cases (such as log files) file could be
silently created when it doesn't exist, and appended if
it exist.

Current tk_get*File model doesn't provide way to handle
such situation.

This patch adds option -allownonexistent to
tk_getOpenFile, which allows it to return valid
non-existent filename just as tk_getSaveFile does and
let application to handle existense of file.

Patch to the getOpenFile manpage is also included.

This patch provides implementation only for Unix and
Windows, since I don't have any Mac handy to debug it.

Discussion

  • Victor Wagner

    Victor Wagner - 2004-08-25

    Patch to tk_getOpenFile -allownonexistent

     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    Requires TIP...

     
  • Victor Wagner

    Victor Wagner - 2005-06-17

    Logged In: YES
    user_id=757679

    Resently I've discovered that provided patch supports only
    Windows NT family, not Windows 9x. I've modified GetFileW
    function, but forget to fix GetFileA. Simular changes should
    be done to it.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.