Tk Source Code

View Ticket
Login
Ticket UUID: 1520742
Title: Windows-style Open and Save file dialog on Unix
Type: Patch Version: TIP Implementation
Submitter: nobody Created on: 2006-07-11 19:34:56
Subsystem: 37. [tk_get*File] Assigned To: dkf
Priority: 8 Severity: Cosmetic
Status: Open Last Modified: 2013-11-03 12:48:03
Resolution: None Closed By: nobody
    Closed on:
Description:
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).
User Comments: dkf added on 2013-11-03 12:44:10:

Dropping priority. Needs:

  • Committing to a branch, ASAP
  • Significant work before merging to any mainline version
Alas.


dgp added on 2009-12-10 22:43:04:
status?

dkf added on 2009-03-28 01:09:51:
I am studying this, and plan to incorporate features from it. But not "as is".

dkf added on 2009-03-26 15:59:59:

IP - Comment Removed: 192.76.146.187

hobbs added on 2007-11-03 00:52:49:
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.

nobody added on 2006-07-12 02:34:57:

File Added - 184580: NewTkfbox.zip

Attachments: