<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://tcl.activestate.com/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Thu Feb 09 07:09:52 GMT 2012 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='8'>
<header><title>Add Winico support to the wm command on windows</title><author address="mailto:vince.darley@eurobios.com">Vince Darley</author><status type='project' state='final' tclversion="8.4.0" vote='after'>$Revision: 1.8 $</status><history></history><created day='6' month='nov' year='2000' /></header>
<abstract>Add to <emph style="italic">wm</emph> the ability to do the windows-titlebar-icon manipulation that the Winico extension currently provides, without the bugs noted in that extension.</abstract>
<body><section title="Proposal">
<para>Modify <emph style="italic">wm</emph> on Windows only to allow an optional <emph style="italic">-default</emph> argument.</para>
<verbatim><vline encoding='base64'>d20gaWNvbmJpdG1hcCAud2lucGF0aCA/LWRlZmF1bHQ/IGZpbGVuYW1l</vline></verbatim>
<para>And to allow a file which is of valid windows-icon format to be interpreted as such. Any file which is not correctly interpreted as an icon will be handled as before, by the <emph style="italic">bitmap</emph> code (which will generally either do nothing, or throw an error, thus maintaining backwards compatibility).</para>
<para>The <emph style="italic">-default</emph> argument, if given, will change not the icon of the .winpath given, but rather the default icon for all windows in the current application for which no specific icon as been set.</para>
<para>An implementation already exists, which fixes the basic &quot;wrapper window&quot; problems and which has the above syntax. The issues surrounding reference counting of icons in use has also been addressed in this patch so that icons no longer in use are released (the Winico patch required manual deletion of icons). This reference implementation is available from <url ref="ftp://ftp.ucsd.edu/pub/alpha/tcl/tkWinWm.diff"/> (documentation has been separately patched, and can also be made available).</para>
</section>
<section title="Rationale">
<para>There have been many requests on <url ref="news:comp.lang.tcl"/> for this ability in the Tk core, and several bug reports filed against Winico, and this ability has been placed on the Tk 8.4 roadmap. <url ref="http://purl.org/tcl/home/software/tcltk/roadmap.tml"/></para>
<para>The choice of <emph style="italic">wm iconbitmap</emph> is suggested, because <emph style="italic">wm iconbitmap</emph> currently doesn&apos;t appear to do anything on Windows, yet is the obvious choice for the user trying to set the window&apos;s icon (e.g. many posts on <url ref="news:comp.lang.tcl"/> are actually asking why <emph style="italic">wm iconbitmap</emph> doesn&apos;t do anything).</para>
<para>In the future we may wish to extend <emph style="italic">wm iconbitmap</emph> on all platforms so that other image types can be accepted (e.g. .gif, .png). This proposal extends naturally to allow such future work. The primary changes required will be icon&lt;-&gt;image conversion routines.</para>
</section>
<section title="Alternatives">
<para>Fix the core so that Winico can work properly as an extension.</para>
<para>My implementation as shown that this would require a couple of patches, and also the exporting of an additional obscure function into Tk&apos;s stub table (a function which would ensure that Tk&apos;s window manager is completely initialised). It would also not help the users posting to <url ref="news:comp.lang.tcl"/> asking &quot;why doesn&apos;t wm iconbitmap do anything?&quot;</para>
</section>
<section title="Objections">
<para><emph style="italic">This is platform specific and should go in an extension</emph></para>
<para>See <emph style="italic">Alternatives</emph> above, also see the <emph style="italic">future suggestion</emph> above in which this kind of code can be usefully extended in a cross-platform way.</para>
<para><emph style="italic">The -default flag is weird, and it means we ignore the window name</emph></para>
<para>I agree, but please suggest a better alternative rather than just moaning. The command with the -default flag is in my opinion more useful than the command without (for example it makes sure that Tk&apos;s built-in dialogs have the icon of your application). An alternative might be to use <emph style="italic">wm iconbitmap -default filename</emph>, but that involves more significant modifications of the semantics of <emph style="italic">wm</emph>. It might, however, be a good idea.</para>
<para><emph style="italic">wm iconbitmap will still do nothing when given a bitmap</emph></para>
<para>Yes, but there&apos;s that backwards compatibility issue. This should be properly documented with pointers to the use of valid icon file formats. When or if proper support is added to Tk for .gif, .png or even Tk images as icons, this bug can be fixed. The purpose of this TIP is not to fix that bug, but to provide a better solution.</para>
</section>
<section title="Copyright">
<para>This document has been placed in the public domain.</para>
</section>
</body></TIP>

