/* Input Module Client - DMS - nov 2000 - by Arnaud QUENTIN */ /*globales : Controles*/ typeof histolst=ObjList;; typeof empty=I;; fun makelst(zone,nb)= let _GETlist (_SELlist zone nb) -> [_ str] in ( _fooS str; if nb==0 then str else strcat strcat (makelst zone nb-1) "\n" str );; fun addlsttozone (lst,zone)= let 0 -> nb in while lst!=nil && nb<20 do ( _ADDlist zone nb hd lst; set lst=tl lst; set nb=nb+1; );; fun autosave(lt,lst)= _createpack (makelst lst _GETlistCount lst) _getmodifypack "InputCookie.txt";; fun _end(s)= _DMSdelete this;; /*callback du bouton Ok : genere l'evenement et passe la chaine saisie*/ /*controlle aussi les chaines nulles*/ fun pressOk(a,zone)= let _GETtext zone -> str in if empty==0 && !(strcmp str "") then 0 else ( if histolst!=nil then (_ADDlist histolst 0 str; _DELlist histolst 20; /*nombre maximum d'element dans l'historique = 20*/ ) else nil; _SETtext zone ""; _SETtextFocus zone; _DMSevent this "sendmsg" str nil; );; /*callback du bouton Cancel*/ fun pressCancel(a,zonetxt)= _SETtext zonetxt "";; /*callbacks : selection d'un element de l'historique*/ fun clicklst(lst,zonetxt,num,str)= _SETtext zonetxt str;; fun Dclicklst(lst,zonetxt,num,str)= _SETtext zonetxt str; _DMSevent this "sendmsg" str nil; _DELlist lst num; _ADDlist lst 0 str; _SETtext zonetxt "";; /* ***************** IniDMI *************** */ fun IniDMI(param)= set empty = atoi param; /*_showconsole;*/ let _DMSgetZone this "input" @_end nil @_end ->[wn x y w h] in let if wn!=nil then _CRwindow _channel wn x y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER (_loc this "NAME_ITEM" nil) else ( set w=180;set h=80; _CRwindow _channel DMSwin 50 50 w h WN_MENU+WN_MINBOX (_loc this "NAME_ITEM" nil) ) -> win in let _CReditText _channel win 5 5 w-10 h-35 ET_VSCROLL|ET_DOWN "" -> Saisie in ( _CBbutton (_CRbutton _channel win 5 h-25 50 20 0 (_loc this "OK_ITEM" nil)) @pressOk Saisie; _CBbutton (_CRbutton _channel win 60 h-25 50 20 0 (_loc this "CANCEL_ITEM" nil)) @pressCancel Saisie; let _DMSgetZone this "history" @_end nil @_end ->[whisto xh yh wh hh] in if whisto!=nil && wn!=nil then ( set histolst = _CRlist _channel whisto xh yh wh hh LB_VSCROLL|LB_DOWN; _CBlistClick histolst @clicklst Saisie; _CBlistDclick histolst @Dclicklst Saisie; addlsttozone (lineextr (_getpack _checkpack "InputCookie.txt")) histolst; /*autosave toutes les 15s...*/ _rfltimer _starttimer _channel 15000 @autosave histolst; 0 ) else 0; );;