Tk Source Code

View Ticket
Ticket UUID: 657656
Title: -initialfile doesn't hilight filenames
Type: Bug Version: None
Submitter: davidw Created on: 2002-12-22 23:52:42
Subsystem: 37. [tk_get*File] Assigned To: hobbs
Priority: 7 High Severity:
Status: Open Last Modified: 2009-08-01 19:55:30
Resolution: Remind Closed By:
    Closed on:
tk_getOpenFile -multiple 1 -initialfile [glob *.jpg]

Lists all of the files in the 'filename' entry,
however, they are not selected.  It would be nice to
have the visual confirmation that the files are indeed
the ones you want, and also "not breaking the metaphor"
or some such.
User Comments: dkf added on 2009-07-29 17:24:12:

IP - Comment Removed:

davidw added on 2005-05-31 23:57:14:
Logged In: YES 

I'd love to say yes, and a few months ago I would have, but
I'm super busy (getting married in a month!).

hobbs added on 2005-05-31 10:57:33:
Logged In: YES 

I'm a slow boy and didn't get around to these patches when
they were fresh.  They don't apply cleanly now.  Could I
bother you to make fresh variants against the cvs head?

hobbs added on 2004-12-06 01:48:39:

data_type - 112997

davidw added on 2004-04-01 06:03:40:

File Added - 82118: fbox.diff

davidw added on 2004-04-01 06:03:38:
Logged In: YES 

And here is the most up to date patch.

davidw added on 2004-04-01 05:56:34:

File Added - 82116: tests.diff

davidw added on 2004-04-01 05:56:33:
Logged In: YES 

Adding a test for malformed -initialfile lists combined with

wolfsuit added on 2004-03-13 07:20:50:

File Added - 79888: macosx-initialfile.patch

davidw added on 2004-03-13 05:36:00:

File Added - 79877: fbox.diff

Logged In: YES 

I have added another patch which corrects something that kbk
pointed out.   Arguments to -initialfile should all be in
the directory displayed.

davidw added on 2004-03-12 18:47:12:
Logged In: YES 

Here is a documentation patch.

dkf added on 2004-02-13 04:11:36:

File Deleted - 38279: 

Logged In: YES 

Assigning to someone who has a working testbed...  :^/

Still required (IMHO):
   Update so that multiple files work on Windows
   Update so that multiple files work on Macs
   Update to documentation
   More careful review of tests

(Also deleted old patch, confusingly named "latest.diff")

dkf added on 2003-12-05 17:23:29:
Logged In: YES 

See TIP#141

dkf added on 2003-07-16 05:28:51:
Logged In: YES 

-initialfile is defined as taking a single file as its
argument.  It has to be that way because there may be
filenames with spaces in floating about (they are
disappointingly common on non-Unix systems, and we
absolutely want to keep the same API.)  Alterations to this
will require a TIP, and hence can't be done for 8.4 at all.

davidw added on 2003-05-16 04:40:55:
Logged In: YES 

    if { [info exists data(selectFile)] } {
for {set i 0} {$i < [::tk::IconList_Index $data(icons) end]}
{incr i} {
    if { [lsearch $data(selectFile) [::tk::IconList_Get
$data(icons) $i]] != -1 } {
::tk::IconList_Selection $data(icons) set $i

Fixes the problem.  I just wrap the code in an if.  If you
want I can update the patch, but it's very simple.

I did attempt to run the whole test suite initially, but I
get a number of failures in things like the font code...

hobbs added on 2003-05-16 01:27:05:
Logged In: YES 

It is the choosedir.test files that are failing, as it appears 
these commands are used there (the Update).  Please make 
sure to run the full test suite for patches.  Here is the failure 
that choosedir.test throws:

can't read "data(selectFile)": no such element in array
    while executing
"lsearch $data(selectFile)  [::tk::IconList_Get $data(icons) $i]"
    (procedure "::tk::dialog::file::Update" line 96)
    invoked from within
"::tk::dialog::file::Update .__tk_choosedir"
    ("after" script)

davidw added on 2003-05-15 18:44:00:

File Added - 50414: tests.diff

davidw added on 2003-05-15 18:43:59:
Logged In: YES 

Here are a few tests to check and see if things are working
properly.  filebox.test now works without problems.  If
there are other errors, would you be so kind as to point
them out?  I get quite a few that seem completely unrelated
to this when attempting to run the whole Tk test suite.

davidw added on 2003-05-15 18:39:21:

File Added - 50413: library.diff

Logged In: YES 

I went back and added some changes that should make things
behave the same with tk_strictMotif on.

hobbs added on 2003-05-15 00:24:12:
Logged In: YES 

There are multiple files with dialog tests, and one of them 
choked on "data(selectFile)" not existing yet.  This was on 
the core-8-4-branch.

davidw added on 2003-05-14 18:58:22:
Logged In: YES 

 Only running test files that match:  filebox.test
Tests began at Wed May 14 01:57:59 PM CEST 2003

Tests ended at Wed May 14 01:58:12 PM CEST 2003
all.tcl:        Total   82      Passed  82      Skipped 0  
    Failed  0
Sourced 2 Test Files.

So.... what is failing where?  This is with a recent (today)
Tcl and Tk.  I will try and add some new tests after I
figure out how things work.

hobbs added on 2003-05-14 06:58:45:
Logged In: YES 

This patch fails the test suite when placed in the head. Needs 
to be accompanied by new tests.

davidw added on 2002-12-27 09:08:20:
Logged In: YES 

There appears to be another problem.  -initialfile selects
multiple files even if -multiple 1 isn't there.

davidw added on 2002-12-27 08:59:33:

File Added - 38279: latest.diff

Logged In: YES 

I am attaching a patch that does two things:

1) It makes it so that one doesn't lose the selection if the
mouse goes out of the window.  This reflects what I see in
both listboxes, as well as other toolkits on Linux.

2) If you have an initialfile, that entry, or entries, are