forsyth20121205-174063a80cc13 years agoHistory
74 lines · 1.7 KB · Text
RawDownload
.TH DIALOG 2.SH NAMEdialog: prompt, getstring \-basic dialog boxes.SH SYNOPSIS.EXinclude "dialog.m";dialog := load Dialog Dialog->PATH; init:        fn();prompt:      fn(ctxt: ref Draw->Context, p: ref Draw->Image,               icon, title, msg: string,               dflt: int, labs: list of string): int;getstring:   fn(ctxt: ref Draw->Context, p: ref Draw->Image,               s: string): string;.EE.SH DESCRIPTION.B Dialogmodule provides two simple dialog boxesfor use by.IR wm (1)applications..B Initshould be called once to initialise its internal state..PP.B Promptuses the graphics context.I ctxtto pop up a dialog box to prompt the user to choose from a set of alternatives,or to acknowledge a message.The box is created near the northwest corner ofthe parent window.IR p ,represented by the window's image.(If the parent window is a Tk Toplevel.IR t ,for instance, the appropriate value is.IB t .image \f1.)\fPIf.I pis nil, the box is centred on the screen.The boxhas the given.I titleand an optional.IR icon .It displays the given.I msgand a number of buttons, labelled with the strings in.IR labs .The dialog box waits for the user to push a button, and thenreturns the index of the button pushed (the first element of.I labsis index 0).If the user types a newline, the.I dfltvalue is returned.  The button with the.I dfltindex is specially outlined in the dialog box..PP.B Getstringpops up a dialog box near the parent window.IR p .The box contains the.I msgand an entry widget.It waits for the user to type a string and a newline,and then returns the typed string, without the newline..SH SOURCE.B /appl/lib/dialog.b.SH SEE ALSO.IR draw-context (2),.IR tk (2),.IR wmlib (2)