1 Lisp Library Modules, Medley Release 1.15, READNUMBER 1 Lisp Library Modules, Medley Release 1.15, READNUMBER READNUMBER 1 READNUMBER 1 READNUMBER 6 ReadNumber(READNUMBER NIL ReadNumber NIL NIL 215) contains functions for implementing a calculator-type menu for entering numbers with the mouse. Installation 1 Load READNUMBER.LCOM from the library. Functions 1 ReadNumber functions are called either from the Executive window or programmatically from another process. The numbers captured by ReadNumber are passed to whatever process currently has the TTY. Create a Key Pad(REATE% A% KEY% PAD NIL reate% a% Key% Pad NIL NIL 215) (RNUMBER(RNUMBER (function) NIL NIL NIL 215) MSG POSITION MSGFONT DIGITFONT INCLUDEABORTFLG FLOATINGPTFLG POSITIVEONLYFLG ACCEPTTYPEINFLG ) [Function] Brings up a menu that looks like a ten-key calculator pad(TEN-KEY% CALCULATOR% PAD NIL ten-key% calculator% pad NIL NIL 215). Your selections, made by pressing the left mouse button when the cursor is on a digit, are accumulated in a displayed total. The key pad includes a backspace key (BS), a clear key (CLR), and a +/- key (-). When OK is selected, the total is returned. If MSG is given, it is displayed at the top of the menu. If POSITION is given, the menu is put there; otherwise it is put at the cursor. If MSGFONT is given, MSG is printed in it. If MSGFONT is NIL, DEFAULTFONT is used. If DIGITFONT is given, the labels on the keys is printed in that font. If DIGITFONT is NIL, BOLDFONT is used. If INCLUDEABORTFLG is non-NIL, the menu also includes an abort key (abt). If the abort key is pressed, RNUMBER returns NIL. Note: If this option is set, you will not be able to use the backspace to correct mistakes. You will have to use CLEAR and begin the number again. If FLOATINGPTFLG is non-NIL, the menu includes a decimal point, and the value returned may be a floating point number. If POSITIVEONLYFLG is non-NIL, the menu does not include a +/- key (-) and you can only input positive numbers (but see ACCEPTTYPEINFLG ). If ACCEPTTYPEINFLG is non-NIL, the menu also responds to user-typed input (i.e., numbers typed in on the keyboard, rather than selected with the mouse). In this mode, carriage return corresponds to OK. Note: The decimal point (.) and the minus sign (-) are also accepted, even though they are not options in the key pad menu. If you close the key pad window, the action taken by RNUMBER depends upon the value of INCLUDEABORTFLG. If INCLUDEABORTFLG is NIL, RNUMBER generates an error (i.e., calls (ERROR!)). If INCLUDEABORTFLG is non-NIL, RNUMBER returns NIL (the same thing it does if the abort key is pressed). Create a Key Pad for Repeated Use(CREATE% A% KEY% PAD% FOR% REPEATED% USE NIL Create% a% Key% Pad% for% Repeated% Use NIL NIL 216) For some applications, it may be beneficial to avoid the creation of the key pad menu window each time a number is asked for. The following functions allow you to create a key pad menu window and use it repeatedly to get values from you. Note: When used in this manner, a key pad menu window can only be used by one process at a time. (CREATE.NUMBERPAD.READER(CREATE.NUMBERPAD.READER (function) NIL NIL NIL 216) MSG WPOSITION MSGFONT DIGITFONT INCLUDEABORTFLG FLOATINGPTFLG POSITIVEONLYFLG) [Function] Creates a window suitable for use by NUMBERPAD.READ (see below). Its arguments are the same as for the function RNUMBER. (NUMBERPAD.READ(NUMBERPAD.READ (function) NIL NIL NIL 216) NUMBERPAD/READER ACCEPTTYPEINFLG) [Function] NUMBERPAD/READER should be a window returned by the function CREATE.NUMBERPAD.READER (see above). NUMBERPAD.READ uses the window in the same manner as the function RNUMBER. Examples 1 (RNUMBER "How many WIDGITS would you like?") results in the following pop-up menu: ‚k˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ŕ€@€@‘"8đáÇÇ@‘"‰€@‘DąĹˆ€*‰€@Ÿ"DP&H€*‰@‘"TQäH€*‰p@‘"TR$E‰€@‘"(R$E‰€@‘(QäB8đáÁ@€@€ @€@€@€p8€@€@@‘DĐGq!Ä@@‘"D0H‘B €@•"DH‘ƒá@•"Dˆ‘B@Š"L0ˆ“"!@Š4Đ Á@€@€@€@€˙˙˙˙˙˙˙@€˙˙˙˙˙˙˙@€@€@€@€ @€ @€Íó@€đmł@€đ ƒ@€ ƒ@€mƒ@€̓@€@€@€@€@€@€@€@€`x@€ŕĚ3@€ŕ @€`@€`0@ƒ˙˙˙˙˙˙˙Ă``3@ƒ˙˙˙˙˙˙˙Ă`Ŕ3@ƒĂ`ü@ƒĂ@ƒ<Ă@ƒfĂ@ƒfĂ@ƒfĂ@ƒfĂ@ƒfĂ@ƒfĂŕ|@ƒ<Ăŕ`3@ƒĂ``0@ƒĂ`ř>@ƒĂ`Ě3@ƒ˙˙˙˙˙˙˙Ăđ 3@ƒ˙˙˙˙˙˙˙Ă`Ě3@€`x@€@€@€@€@€@€@€@€đx@€0Ě3@€`Ě3@€`x3@€ŔĚ@€ŔĚ@€€Ě3@€€x@€@€@€@€@€@€@€@€x@€Ě@€Ěćc@€˛Ě6Ă@€¸Ě7ƒ@€ŽĚ6Ă@€ŚĚ6c@€<xć3@€@€@€@€@€˙˙˙˙˙˙˙@€˙˙˙˙˙˙˙@€@˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ŕ (RNUMBER "How far to the left?") NIL '(CLASSIC 12) '(MODERN 14) T T) results in the following pop-up menu: •f˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ř€€€œŕ0Ŕ €ˆ@P@B@B@ˆ@@@B@B@ˆC7`áĂŔń€ňÁ€C8đ@Ä’@B!@B@C"@D@€ˆDŠ€@áB@B#ŔGAˆDŠ€A!B@B"DAˆD…BaR@R"@DPœă᳀a€gq€ă8a€€€€˙˙˙˙˙˙˙č€˙˙˙˙˙˙˙č€h€Ţzh€RJ+IM.INDEX.GETFNMODERN   -4   HRULE.GETFNMODERN .&’ BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) $!& BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8))    HRULE.GETFNMODERN ,% ízş