Eskil

Check-in [092ef70929]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix filedrop in fourway
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 092ef709298356e6f9c63f798b781f8d001d12e72ceb602fd8226703449de83e
User & Date: peter 2018-05-13 00:01:40
Context
2018-05-13
05:32
Release 2.8.2 check-in: 6d18df4a6a user: peter tags: trunk
00:01
Fix filedrop in fourway check-in: 092ef70929 user: peter tags: trunk
2018-05-12
23:30
Bumped revision to 2.8.2 check-in: 97def5b85e user: peter tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/fourway.tcl.

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
            dnd bindtarget $win.e2 text/uri-list <Drop> "[mymethod fileDrop change1] %D"
            dnd bindtarget $win.e3 text/uri-list <Drop> "[mymethod fileDrop base2  ] %D"
            dnd bindtarget $win.e4 text/uri-list <Drop> "[mymethod fileDrop change2] %D"
        }
    }

    # File drop using TkDnd
    method fileDrop {field files} {
        if {$field eq "any"} {
            # Dropped outside the entry widgets. Try to be clever.
            set todo {}
            # Drop in empty fields first
            foreach field $fields {
                if {$files($field) eq ""} {
                    lappend todo $field
................................................................................
            # Fill fields otherwise
            if {[llength $todo] == 0} {
                set todo $fields
            }
        } else {
            set todo [list $field]
        }
        foreach fn $files field $todo {
            # Loop until any list ends
            if {$fn eq "" || $field eq ""} break
            # Sanity check
            if {[file exists $fn]} {
                set files($field) $fn
            }
        }







|







 







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
            dnd bindtarget $win.e2 text/uri-list <Drop> "[mymethod fileDrop change1] %D"
            dnd bindtarget $win.e3 text/uri-list <Drop> "[mymethod fileDrop base2  ] %D"
            dnd bindtarget $win.e4 text/uri-list <Drop> "[mymethod fileDrop change2] %D"
        }
    }

    # File drop using TkDnd
    method fileDrop {field filesDropped} {
        if {$field eq "any"} {
            # Dropped outside the entry widgets. Try to be clever.
            set todo {}
            # Drop in empty fields first
            foreach field $fields {
                if {$files($field) eq ""} {
                    lappend todo $field
................................................................................
            # Fill fields otherwise
            if {[llength $todo] == 0} {
                set todo $fields
            }
        } else {
            set todo [list $field]
        }
        foreach fn $filesDropped field $todo {
            # Loop until any list ends
            if {$fn eq "" || $field eq ""} break
            # Sanity check
            if {[file exists $fn]} {
                set files($field) $fn
            }
        }