Charles.Forsyth20060303-partialeea662d19 years agoHistory
102 lines · 2.4 KB · Text
RawDownload
.TH POPUP 2.SH NAMEPopup: mkbutton, changebutton, event, add \- popup list box pseudo-widget.SH SYNOPSIS.EXinclude "popup.m";popup := load Popup Popup->PATH; init:         fn();mkbutton:     fn(win: ref Tk->Toplevel, name: string,                 items: array of string, n: int): chan of string;changebutton: fn(win: ref Tk->Toplevel, name: string,                 items: array of string, n: int);event:        fn(win: ref Tk->Toplevel, e: string,                 items: array of string): int;add:          fn(items: array of string, s: string):                 (array of string, int);.EE.SH DESCRIPTION.B Popupimplements popup list boxes as Tk pseudo-widgets.This module has since been superseded by.IR choicebutton (2)in Tk itself, but remains for the moment for compatibility..PP.B Initmust be called once to initialise the module..PP.B Mkbuttoncreates a new button.IR name ,in Tk toplevel.IR win .It returns a channel on which it delivers events (see.BR event ,below).Once created,.I namecan be packed like any other Tk widget.When the button is pressed with button 1,a menu pops up offering a choice from the given.IR items .The value.I nis the index in.I itemsof the button's initial value.The current choice is always displayed in the button.If.I itemsis nil or an empty array, the string.RB ` ----- 'is displayed instead..PPHaving created a popup button, the application must receive values onthe channel returned by.B mkbuttonand pass each value it receives to.BR event(as parameter.IR e ).(Typically the application will receive on the channel in an.B altstatement that watches other channels too.).B Eventreturns the result of a selection, or -1 if no selection was made.In either case, the text of the button.I namewill reflect the currently active selection(the application can fetch it using.RB ` cget\ -text ').The.I itemsparameter must match that given to.B mkbutton(or most recently given to.BR changebutton )..PP.B Changebuttonchanges the list of.I itemsin an existing popup button.IR name ,and sets its initial selection to the item with index.IR n ..PP.B Addadds string.I sto the array.IR items ,if it is not already there,and in either case returns the resulting new array andthe index of.I stherein.It is useful for calculating a list of items dynamically..SH SOURCE.B /appl/lib/popup.b.SH SEE ALSO.IR tabs (2),.IR tk (2)