'''Purpose:''' Provide a collection of hints for making Tk more convenient on Microsoft Windows. * If you write to ''stdout'' or ''stderr'', and haven't redirected your standard channels, you are writing into the [Windows Wish Console] whether you know it or not! Once you get more than a few hundred lines of output into it, the Wish console gets very slow; visit the page referenced above to see how to take care of it. * The care and feeding of the system menu is discussed in [menu]. * [Windows Wish Console] has some tricks for dealing with the Tk console on the Windows platform. The [menu] page shows how to add a ''Show Console'' item to the system menu. * ([KBK] 8 January 2001) The Wish console can also be used from within C++ code; [Cplusplus streams and Tcl channels] shows how. * [Printing a canvas under Windows] shows one way to get printout from the canvas on Windows. * There are various hints on running DDE, on a page called, predictably enough, [dde]. * Example of using the registry package can be found at [Windows Registry Browser] * [Invoking browsers] shows how to launch a Web browser under control of a Tcl script. * There is a collection of hints on how to deal with a [serial port]. * [Bag of algorithms] has help in dealing with the Windows file system, including how to test if a drive has media in it, how to tot up the free space on a drive, and how to deal with variant line terminators (CR/LF vs. LF only). * [TEA] includes a discussion of how to build a native-code extension on Windows using Visual C++. (Alas, it's an embarrassment to the Windows using portion of the Tcl community! Hopefully someone who programs in this area steps forward to assist in improving the situation.) * '''Text widget contents''', even with exotic Unicodes, can be printed on WinNT by copying and pasting into a Notepad, provided you have a Unicode font like Bitstream Cyberbit (recent Microsoft fonts also support Greek, Russian, Arabic, Hebrew), and have set Notepad to use that. The "higher" editors like Wordpad and Word don't accept exotic text pasting so easy, since they refer to an explicit font setup that also includes the language. ''RS'' * An installation program will often want to [Register file types under Windows] so that users can invoke a Tcl script on a file by double-clicking the file. * If a Tk app pops up a fileselector dialog at its beginning, the main window may not react to clicks or keys even if it seems to be in focus. A (on Unix redundant) ''update'' before the fileselector command fixed that. - RS * tk_chooseDirectory on Windows can be annoying by return all file names in full caps. An improved tk_chooseDirectory [winChooseDirectory] corrects this. Hopefully this will be resolved in 8.4. -TFW * For finer control of the "launch conditions" of process spawning, use [start]. * Tk can fake the little thingy with three diagonal lines that lives at the lower right corner and lets you resize a window. [Resize control] shows how. * A different implementation for a windows like [sizer control]. * This [Windows Application Framework] automates some of the repetitive tasks for making an application with a Windows feel. ---- What if you want "to go the other way", and, for example, "[Give Unix a Windows look and feel]"? There's a Wiki page for that, too. ---- Interesting note - recently someone on comp.lang.tcl reported that a Hewlett Packard Pavillion, running Windows XP, came with Tcl installed. Another user reports that Morton Kern Systems MKS Toolkit - a package of Unix-like utilities for Windows, comes with Tcl/Tk (along with Perl, awk, etc.). Jeff Hobbes mentioned that Microsoft's [Interix] toolkit comes with Tcl along with 'a ton' of other "unix" utilities. And of course Cygnus comes with a version of Tcl/Tk (and there are users which provide newer versions of Tcl/Tk/other extensions for Cygnus). ---- ''[Sarnold] 2006-04-25'': There is a bug in Tk 8.4.12 with Windows ME. When you close the application window, a ''wish'' process still is in background (no window attached to it, but you can see it if you press Ctrl-Alt-Delete). So the following line is needed to avoid this behaviour: bind . {exit} The minimal script needing this trick follows here: while 1 {catch {update}} [MG] Is this actually a bug? This happens in XP too with the code above, but only when there's an infinite loop running. If you have a loop like set i 150000 while {$i} {incr i -1 ; catch {update}} then the process exits when the loop reaches its end. This seems more like a useful feature than a bug, to me, giving you the chance to finish something important you could be doing in a loop when a user closes the app, but still (with the bind) giving the opportunity to break out of the loop if you prefer... ---- See also [Microsoft Windows and Tcl] - [Windows/CE] - [Windows: getting desktop properties] --- [LV] Anyone have a list of things that either work differently, or do not work at all, when using Tk on Windows as opposed to *nix systems? ---- [Arts and crafts of Tcl-Tk programming] - [Category Windows]