Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TIP #242: PRESELECT FILTER ON TK_GET*FILE DIALOGS

1 view
Skip to first unread message

Brian Griffin

unread,
Apr 18, 2005, 4:50:00 PM4/18/05
to

TIP #242: PRESELECT FILTER ON TK_GET*FILE DIALOGS
===================================================
Version: $Revision: 1.1 $
Author: Brian Griffin <bgriffin_at_model.com>
State: Draft
Type: Project
Tcl-Version: 8.5
Vote: Pending
Created: Thursday, 03 March 2005
URL: http://www.tcl.tk/cgi-bin/tct/tip/242.html
Post-History:

-------------------------------------------------------------------------

ABSTRACT
==========

This TIP proposes adding an *-initialtype* option to the
*tk_getOpenFile* and *tk_getSaveFile* dialog box commands. This option
will preselect the filter from the *-filetypes* list based on the type
name.

RATIONALE
===========

The standard Open and Save dialog boxes currently allow you to seed the
initial directory and the initial file, but selecting the initial
filter should be supported as well. It is common to use a single dialog
with a variety of filter options as a way for the user to select the
import or export type, rather then having the user select a type before
opening the dialog. By giving the application control over selecting
the filter, the UI can be made friendlier to the user since the current
operation is mostly similar to previous operations. For example, if you
just opened a .txt file, the next open the user performs is most likely
also a .txt file, so requiring the user to adjust the filter again is
extra, unnecessary work.

PROPOSED CHANGE
=================

Add an *-initialtype* option to *tk_getOpenFile* and *tk_getSaveFile*.
The value will be the filter name, that is, index 0 of the extension
definition. For example, given:

set types {
{{Text Files} {.txt} }
{{TCL Scripts} {.tcl} }
{{C Source Files} {.c} TEXT}
{{GIF Files} {.gif} }
{{GIF Files} {} GIFF}
{{All Files} * }
}
tk_getOpenFile -types $types

For selecting .c files for the filter, the *-initialtype* option would
be "-initialtype {C Source Files}".

REFERENCE IMPLEMENTATION
==========================

A reference implementation will be posted to Tk patches. I have
modified /tkfbox.tcl/ and /tkWinDialog.c/. I have not looked at MacOSX
yet.

COPYRIGHT
===========

This document has been placed in the public domain.

-------------------------------------------------------------------------

TIP AutoGenerator - written by Donal K. Fellows

[[Send Tcl/Tk announcements to tcl-an...@mitchell.org
Announcements archived at http://groups.yahoo.com/group/tcl_announce/
Send administrivia to tcl-announ...@mitchell.org
Tcl/Tk at http://tcl.tk/ ]]

0 new messages