/* enter box - nov 97 - by Sylvain Huet a box to enter any data */ /* enter box structure */ struct EnterBox= [chEnterBox:Chn,winEnterBox:ObjWin,txtEnterBox:ObjText,endEnterBox:fun[S] I] mkEnterBox;; fun _ok(x,b)= let _GETtext b.txtEnterBox -> s in (_DSwindow b.winEnterBox; exec b.endEnterBox with [s]) ;; fun _cancel(x,b)= _DSwindow b.winEnterBox; exec b.endEnterBox with [nil] ;; fun _destroyE(x,b)= exec b.endEnterBox with [nil];; fun lineok(a,b,c)=_ok nil b;; fun _focusevent(a,b)=_SETtextFocus b.txtEnterBox;; fun iniEnterBox(ch,father,x,y,title,end,txt)= let _CRwindow ch father x y 300 80 WN_MENU+WN_MINBOX title -> win in let _CRtext ch win 5 5 290 20 ET_BORDER txt -> banner in let _CReditLine ch win 5 30 290 20 ET_PASSWORD+ET_DOWN+ET_AHSCROLL "" -> text in let _CRbutton ch win 5 55 70 20 0 "Ok"-> ok in let _CRbutton ch win 80 55 70 20 0 "Cancel"-> cancel in let mkEnterBox [ch win text end]-> b in (_CBwinDestroy win @_destroyE b; _CBwinFocus win @_focusevent b; _CBbutton ok @_ok b; _CBbutton cancel @_cancel b; _CBlineOk text @lineok b; _SETtextFocus text; b) ;;