Menu

#220 Windows-style Open and Save file dialog on Unix

TIP Implementation
open
9
2009-01-06
2006-07-11
Anonymous
No

Email:matthew.middleton@ansys.com
An attachment with the necessary source files is
attached.

The tk_getOpenFile and tk_getSaveFile have been
greatly improved to function much like a windows
dialog taken from Windows 2000, when the default
dialogs are overridden.
This is most useful on Unix systems where the
application is wanted to have a Windows-like
appearance, but it will also function on Windows.
I have not been able to test on Macintosh.
This also affects tk_chooseDirectory when the default
dialogs are overridden since it runs off of
tkfbox.tcl.

The dialogs will work without the BWidget package,
but it will have more functionality and look more
like a windows dialog if BWidgets are included.
The only thing it really needs from BWidgets is the
ComboBox widget. If this were included in regular
Tk, then BWidgets would not be needed.
It also uses the balloon messages of the "Button"
widget from BWidgets.

This new file dialog widget requires two of the new
widgets included -- ResizeButs and tk_fileProperties.
I added these lines to the file "tclIndex" to get it
to find these commands:
set auto_index(ResizeButs) [list source [file join
$dir ResizeButs.tcl]]
set auto_index(tk_fileProperties) [list source [file
join $dir tkfprops.tcl]]

The two tcl files that define these widgets are
included (ResizeButs.tcl and tkfprops.tcl), along
with documentation on each one.

The file choosedir.tcl is also included. It is
needed to work with the modified tkfbox.tcl.

Added functionality of the file dialog:
1. Back directory button
2. Create directory button
3. Details button
4. Delete button
5. You can type the directory path at the top
(requires BWidgets). Selecting "desktop" expands
what's available on the desktop if used on Windows.
Right mouse clicking on a file gives these
options:
1. Cut
2. Copy
3. Delete
4. Rename
5. Properties (uses tk_fileProperties
widget)
Right mouse clicking in open white space gives
these options:
1. View
1. List
2. Details
2. Arrange Icons
1. By Name
2. By Size
3. By Type
4. By Date
3. Refresh
4. Paste (ungreys if Cut or Copy were
previously selected on files)
5. New Folder
6. Properties (uses tk_fileProperties
widget)
6. Recent selected files can be shown by
pressing the down arrow in the entry field of the
selected file name (requires BWidgets). Recent file
names are saved to a file named

.tk_recent_selections in the users home directory.
7. Box selecting of files can be done with
the "multiple 1" option. Left mouse click and hold
and drag a box over files.
8. The busy was improved to actually block
mouse clicks instead of just showing an hourglass
widget.
9. Popup button descriptions. (requires
BWidgets)
10. Icons shade as well as text when selected.

Details view
The Details button grids 4 columns (name, file
type, size, and modified date). (uses ResizeButs
widget)
Moving the mouse over the border between two
buttons of the top column headings and left mouse
clicking while dragging will allow the user to change
the size of the columns.
Pressing one of the heading buttons changes the
order of the data between increasing and decreasing
and displays a triangle in the button to indicate the
order.

Additional Arguments to the tk_getOpenFile and
tk_getSaveFile commands
The dir_leaf arguments allow a folder to be
selected as a file to select it as a project.
Providing a -dir_leaf_check procedure defines the
file dialog as a special type that only

lists folders, but the folder that passes the -
dir_leaf_check procedure can be selected as a file.
1. -dir_leaf_check -- This is the name of a
procedure which checks if the directory qualifies as
the kind that can be selected as a project file. It
returns a non-zero number if it

qualifies, otherwise it returns zero. The directory
name to check will be appended as an argument to the
procedure.
2. -dir_leaf_image -- an image to use for the
folder types that will be treated as files. It
should be an image created with "image create photo"
3. -dir_leaf_label -- text that appears at the
left of the entry for the selected file when the
dialog is defined as a project folder selection type
(when the -dir_leaf_check

procedure is defined).

Discussion

  • Nobody/Anonymous

    Zip file containing the necessary files for the new tkfbox.tcl

     
  • Donal K. Fellows

    • labels: 319116 --> 37. [tk_get*File]
    • assigned_to: tmh --> hobbs
    • milestone: 352719 -->
     
  • Donal K. Fellows

    • milestone: --> TIP Implementation
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2007-11-02
    • priority: 5 --> 6
    • assigned_to: hobbs --> dkf
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2007-11-02

    Logged In: YES
    user_id=72656
    Originator: NO

    dkf - you want to reconcile some of these additions with your other recent dialog updates? 8.5 is a good time to update dialogs.

     
  • Donal K. Fellows

    • priority: 6 --> 9
     
  • Donal K. Fellows

    I am studying this, and plan to incorporate features from it. But not "as is".

     
  • Don Porter

    Don Porter - 2009-12-10

    status?