include "wmlib.m"; wmlib:= load Wmlib Wmlib->PATH; Resize, Hide, Help, OK: con 1 << iota; Appl: con Resize | Hide; init: fn(); titlebar: fn(t: ref Tk->Toplevel,title: string, buts: int) : chan of string; titlectl: fn(t: ref Tk->Toplevel, request: string); taskbar: fn(t: ref Tk->Toplevel, name: string) : string; getfilename: fn(screen: ref Draw->Screen, parent: ref Tk->Toplevel, title, pat, dir: string) : string; geom: fn(t: ref Tk->Toplevel) : string; snarfput: fn(buf: string); snarfget: fn(): string;
An application is informed of Tk events by a channel that is returned by titlebar. (See Tk -graphics toolkit in Chapter 13). Messages received on it should be processed by the application. The messages that may arrive on the returned channel are:
In some cases the appropriate response is to make the received message the request argument to the titlectl function.
titlectl (t, request)
The titlectl function performs a variety of operations according to the string passed in argument request. The supported requests are:
taskbar (t, name)
The taskbar function changes the name displayed in the title bar and the window's name when it is in the task bar. getfilename (screen, parent, title, pat, dir)
The getfilename function makes a dialog box for selecting a file. It is displayed on screen near parent. The dir argument gives the directory where the file search should begin. Only files that match pattern pat are displayed. The rules for defining match patters are described in filepat: expand, match - file pattern matching.
The returned string is the name of the selected file, or the empty string if no file was selected.
geom (t)
The geom function returns a string with the coordinates for a child window. snarfget ( ) and snarfput (buf)
The snarfget and snarfput functions retrieve and replace the contents of the window manager's snarf buffer. Files
/chan/wm
|
Interface with wm for the titlectl function's handling of move and size requests.
|
/chan/snarf
|
Interface with wm for the snarfget and snarfput functions.
|
context - graphics environment in Chapter 11
|
Tk -graphics toolkit in Chapter 13
|
tklib: tkquote, is_err, tkcmds, dialog, getstring, notice, mktabs, tabsctl - Tk user interface functions in Chapter 13
|