CLIM mail archive

[Prev][Next][Index][Thread]

Polling Composite Gadget.



    Date: Mon, 17 Jan 1994 19:03 EST
    From: Whitney Winston <wwinston@medg.lcs.mit.edu>


    Hi--

    I need a gadget which can poll various objects within an application
    which runs autonomously from any GUI.  Ideally, it could be
    implemented as a composite gadget which would take an argument
    determining the number of seconds between polls.  Then, the gadget
    would call a (setf gadget-value) on each of it's children with
    the appropriate value obtained from the autonomous application.
    Then the value-gadges would each have a method on (setf gadget-value)
    so that they could update the display accordingly.  

    How would I implement this?

    Here are the choices that I see:

	    o   Place a timer-event in the composite objects queue so that
		it will be able to determine whether the specified number
		of seconds has passed and then update the children gadgets
		accordingly.  (Will this work?)

	    o   Change the read-eval-print loop to handle composite
		polling gadgets.  (I don't like this since it provides 
		an awkward interface).  

There are functions called CLIM-UTILS:MAKE-TIMER and CLIM-UTILS:ADD-TIMER
that should work in every multi-processing CLIM implementation.  (Really,
we should have exported them from the CLIM-SYS package -- oh, well.)

So...

(let ((timer (clim-utils:make-timer 
	       :delay 5		;seconds before first firing
	       :interval 10	;seconds between firings
	       :function #'(lambda (timer) <your code here>))))
  (clim:add-timer timer))	;starts the timer

You can use CLIM:DELETE-TIMER to remove it.  If :INTERVAL is NIL in the
call to MAKE-TIMER, the timer will fire only once.

References:

Main Index | Thread Index