Re: Image viewing - a different approach



Dnia 22.01.2008 Glenn Jackman <glennj@xxxxxx> napisał/a:

namespace eval launch {
switch -glob -- $::tcl_platform(os) {
Darwin { set start_cmd open }
"Windows *" { set start_cmd start }
default {
# need more expertise here...
error "don't know how to launch a file on os $::tcl_platform(os)"
}
}
variable launch_cmd [auto_exe*** $start_cmd]
}
proc launch::file {filename} {
variable launch_cmd
eval exec [list $launch_cmd $filename &]
}

launch::file myimg.jpg

If I properly understood, it's a method for platform-independent "launch"
("run", "exec"... whatever) command. But my intention was somewhat
different: I would to create some kind of "link", which could be then
pack-ed anywhere in chosen toplevel - and such link, when clicked by the
user, would then be seen by OS as "shortcut to file"; exactly the same
kind of shortcut, as every Windows user has his desktop filled with.

Such way we don't have to care about file type, launch command and other
details anymore... everything has been set much earlier by the user,
according to his needs.

This would be best solution for both programmer (less work, of course...),
and the user (less work by setup/configuration, of course... all is prepared
already along with his OS's file associations).

I'm not sure, is it currently possible at all. If not - perhaps could be
*something* added in future versions of Tk?
--
ZB
.