/* Text Editor - juil.97 - par Sylvain Huet */ /* add localisation (must define "loc" function) - may 2001 - by macfly */ struct TextEdit3= [chText:Chn,winText:ObjWin,bannerText:ObjText,textText:ObjText, okText:ObjButton,cancelText:ObjButton,endText:fun [S] I]mkText;; fun _ok(x,b)= let _GETtext b.textText -> s in (_DSwindow b.winText; exec b.endText with [s]);; fun _cancel(x,b)= _DSwindow b.winText; exec b.endText with [nil];; fun _destroy(x,b)= exec b.endText with [nil];; fun _resizeT(a,b,x,y)= if (y<100) then nil else (_SIZEtext b.bannerText x-10 20 5 5; _SIZEtext b.textText x-10 y-60 5 30; _SIZEbutton b.okText 40 20 5 y-25; _SIZEbutton b.cancelText 40 20 50 y-25) ;; fun iniText(ch,father,w,h,title,txt,end,file)= let _CRwindow ch father nil nil w h WN_MENU+WN_MINBOX+WN_SIZEBOX title -> win in let _CRtext ch win 5 5 w-10 20 ET_BORDER txt -> banner in let _CReditText ch win 5 30 w-10 h-60 ET_DOWN+ET_HSCROLL+ET_VSCROLL file -> text in let _CRbutton ch win 5 h-25 40 20 0 loc "OK" -> ok in let _CRbutton ch win 50 h-25 60 20 0 loc "CANCEL" -> cancel in let mkText [ch win banner text ok cancel end] -> b in (_CBwinDestroy win @_destroy b; _CBwinSize win @_resizeT b; _CBbutton ok @_ok b; _CBbutton cancel @_cancel b; _SETtextFocus text; b );; fun _destroyevent(s)=_fooS s;_closemachine;; fun main()= iniText _channel nil 300 300 loc "TEXT_EDITOR" loc "EXAMPLE" @_destroyevent _getpack _checkpack "custom.txt";;