Version 6 of Migration to 8.4: Tk Private Commands

Updated 2002-07-12 20:11:45

Page to record guidelines for dealing with the private commands renamed in Tk 8.4.


An example:

Hey, my script doesn't work with Tk 8.4! It says "invalid command name "tkTabToWindow""

Tk 8.3 defined a private command [tkTabToWindow]. Tk 8.4 no longer does. It was never a public interface, and when you use private interfaces you risk getting caught by changes like this.

Quick workaround. Add this to your script:

    tk::unsupported::ExposePrivateCommand tkTabToWindow

That will restore the existence of the [tkTabToWindow] command. If you've used other private commands you will need to do the same for each of them.

Longer term, you should re-write your script so that it doesn't make use of Tk's private commands. If you find that this is too limiting, and access to the private commands is necessary, then get to work making a TIP proposal for Tk to provide that functionality in a public way:

        http://purl.org/tcl/tip/

IDG Have virtual events like <<cut>> and <<paste>> also been privatized in 8.4? The documentation of these has always seemed a bit unclear to me. i.e. is an application programmer allowed to know the contents of tk.tcl?


See TIP 44 [L1 ]


See also Changes in Tcl/Tk 8.4


IDG I guess my comments re virtual events reflect a need for documentation improvements. For example, the latest documentation of the text widget [L2 ] tells us, among other things,

The F18 key (labelled Paste on many Sun workstations) or Control-y inserts the contents of the clipboard at the position of the insertion cursor. This action is carried out by the command tk_textPaste.

The documentation doesn't tell us that <<paste>> exists. This seems 180 deg out of phase with the thrust to hide things like tk_textPaste.

It would be nice if the widget documentation gave a list of all the virtual events which are defined for the widget.