[cells-devel] How to force minimum delay between events in Cells?

Kenneth Tilton kentilton at gmail.com
Sun Feb 15 18:04:00 UTC 2009



Mikko Ahonen wrote:
> Hello,
> 
> My first cells application was in production last week. I used 
> LispWorks, CAPI and Cells to create an application which was used to 
> verify names for people who are coming into an exhibition opening in the 
> biggest museum in Finland. It was an touch screen application, and 
> contained on-screen keyboard etc. It only took few days to complete and 
> test the program. Everything worked perfectly!

Awesome. We will declare you the Cells User of 2009. I pick up one a 
year. Someone get the lights, I am going fishing.

:)

> 
> I had to cut few corners from the original specification, however. The 
> keyboard was implemented using mouse button push and release events, 
> which displayed the proper images representing the state of the buttons 
> (button disabled, up or down). What I wanted was to force minimum delay 
> after button down event before button up, so the key flashes just 
> slightly longer. Any ideas what would be the best way to accomplish this?

What I have done in the past is have a cell somewhere that gets 
internal-real-time stuffed into it, and then write rules that 
effectively terminate highlighting with:


    (and (mouse-up self)(> (- (current-time *app*) start) 250)))

Where:

  *app* : an instance of some arbitrary class I make up to represent 
global application state (and usually has windows as children). In 
cells-qx I guess this will be a web session. Anyway...

  current-time : the aformentioned cell where get-internal-time gets stuffed

  start : a local variable set on mousedown

But this works in Cello/Celtk because they sit in a tight loop polling 
for events and I can update the slot after each polling (they return at 
once if no events are available from Tcl). if you do not have this, does 
CAPI have some kind of timer mechanism you can leverage? GUIs often do. 
Then you have to do some clever coding to leverage the timer.

I /think/ the example code for Celtk might show that. I know in the 
first code I did I used the timer because I was mimicking Peter Herth's 
example as closely as possible.

If you get stuck lemme know. Maybe LW has a timer mechanism outside CAPI?

kenny





> 
> Best regards,
> 
> Mikko Ahonen
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> cells-devel site list
> cells-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cells-devel
> 
> 
> ------------------------------------------------------------------------
> 
> 
> Internal Virus Database is out of date.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.176 / Virus Database: 270.10.13/1914 - Release Date: 1/24/2009 8:40 PM
> 




More information about the cells-devel mailing list