two_util(n) manual page

Back to the Index
Table of Contents

Name

two_busy - show busy cursor and block interacition
two_center - center window on the screen
two_ct - Retrieve current toplevel
two_invoke - Invoke a button with visual feedback
two_kshPwd - Replacement for cd and pwd to behave like the Korn shell
two_mb - Simplified messagebox
two_noExportImport - Disable all copying to and from the application
two_showCenter - Show window and center it on the screen

Synopsis

package require twoUtil ?1.0?
two_busy TCL_BOOLEAN widget ?widgets?
two_center widget [parent]
two_ct
two_invoke widgetpath
two_mb options
two_noExportImport
two_showCenter widget [parent]

Description

two_busy

Show a busy (watch) cursor and block all user interaction. This is achieved through a transparent frame which is placed on top of all child widgets. If the first arguments is FALSE, this frame is removed and all returns to normal behavior.
It's a known bug that transparent frames don't propagate redraw events, so the underlying widgets don't repaint at all. Looks like a blocked application. Won't make any difference if your app really blocks, but if it doesn't... it's ugly.

two_center

This one will move widget to the center of the screen. If the optional parent is given, then this parent will be deiconified and widget will be placed on top of it, using the same virtual screen. The parent defaults to '.'.

two_ct

Returns the current toplevel, i.e. the toplevel which currently contains the focus. If the application doesn't have the focus, a single '.' is returned.

two_invoke

Invoke a Tk button named widgetpath. Before actually calling the invoke method, the button is flashed as if it were pressed with the mouse. Using this function with a label will set the keyboard focus to the next widget in the focus order.

two_kshPwd

Installs a replacement for pwd and cd to make both of them behave like the built-in commands in the Korn shell (ksh) or the ones in the HP-UX Posix Shell. Users might especially want to use this if they keep getting /tmp_mnt/ on their paths.

Some background: There are two ways to retrieve the current working directory. The one used by tclsh is the C-Library version which basically walks up the '..' links in each directory to find the generic name of the current working directory. This is unique as long as there are no symbolic links to directories: those links make it possible to access a directory through different paths, but the generic way to retrieve the name of the current directory will always return the same name.

What the ksh does different now is that it stores the user-supplied path name and returns this one on pwd requests. Relative cd commands are interpreted relative to the stored pathname, and '..' removes the last component of the path rather than using the file systems uplink. The replacement commands installed by two_kshPwd apply these semantics, which will affect, e.g., the tk_getOpenFile commands.

Doing it the original tclsh way gets rather annoying if you are using the automounter on UNIX Systems: this beast will mount directories on demand and unmount them after some idle time. The auto mounting is triggered by accessing anything within the directory tree which should be mounted. Unfortunatly, the automounter will set the real mount point in /tmp_mnt/ and only use symbolic links in the place where you would expect the mount point to live.

The problem with all that is that a /tmp_mnt/ path is not only less beautiful, but also will not trigger the re-mounting of a directory.

The fact that there are several ways to interpret '..' and all of them are mixed in several places has obvously bitten almost any UNIX user at some time. Please note that this replacement does only affect cd and pwd commands; accessing a file for open or any other command will not use these new semantics! But then, this is the same in ksh.

two_mb

Just a thin wrapper around the tk_messageBox which sets the parent widget to a reasonable value.

two_noExportImport

Disables all copying to and from the application. Disabling the export function is easy through exportSelection none, but disabling the importing of the seletion is a bit trickier. It is achieved here through replacing the selection and clipboard commands. Caveat: You'll have to call this function before instantiating any widget in order to make the option add used by this function work.

two_showCenter

Will show the widget (i.e. raise/deiconify it). If the widget was withdrawn, it will be moved to the center of the screen. See also two_center. Note that mapped and iconified widgets are made visible, without changing their former position, while only withrawn widgets are moved.

Author

Frank J. Leitner
frank@fjl.de

See Also

button(n) , clipboard(n) , option(n) , selection(n) , tk_messageBox(n) , wm(n) .


Table of Contents


Back to the Index