Re: c-formula and setf
2009-02-15 16:24:09 GMT
> A cell should be calculated by a > formula if it isn't set to a value. I think the easiest way to achieve that would be to just use two cells, one c? and one c-in, and just have the former be equal to the latter if it is set, and to some formula if it is not. If you really want to have a consistent interface to the slot you should consider overriding accessor methods. Regards, Jakub
How to force minimum delay between events in Cells?
2009-02-15 17:12:36 GMT
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!
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?
Best regards,
Mikko Ahonen
<div><p>Hello,<br><br>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!<br><br>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?<br><br>Best regards,<br><br>Mikko Ahonen </p></div>
c-formula and setf
2009-02-15 15:23:23 GMT
Hi, I don't know if that has been discussed yet, but I've several use cases where I want to do sth. like that: A cell should be calculated by a formula if it isn't set to a value. I thought that's possible with (c-formula (:inputp t) ... ), which does calculate the slot by a formula and can be setf, but how is it possible to unset the setf value and let cells calculate it again? Example: A textbox is by default calculated by a formula. If the user enters sth. into it, that value is used. If the user clears the field of his input, the value should be calculated again. Maybe the c-formula ... approach is completely the wrong way or that's not possible at all. I've read the documentation and primer but couldn't find anything helpful. Sorry, I'm new to cells. Cheers, Bastian
Re: How to force minimum delay between events in Cells?
2009-02-15 18:04:00 GMT
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
>
Re: c-formula and setf
2009-02-15 17:48:53 GMT
Bastian Müller wrote:
> Hi,
>
> I don't know if that has been discussed yet, but I've several use cases
> where I want to do sth. like that: A cell should be calculated by a
> formula if it isn't set to a value. I thought that's possible with
> (c-formula (:inputp t) ... ), which does calculate the slot by a formula
> and can be setf, but how is it possible to unset the setf value and let
> cells calculate it again?
>
> Example: A textbox is by default calculated by a formula. If the user
> enters sth. into it, that value is used. If the user clears the field of
> his input, the value should be calculated again.
Could you just have?:
(or (user-entered-value self)
(calculated-value self))
One thing not clear to me is how you know they first indicate they want
to enter a value and then communicate that they have decided against,
and those things really come into play.
Lemme know and I'll tell you how I would handle it.
Pretty much I would avoid SETF as much as possible and end up with
something still formulaic:
(if (user-owns-value self)
(editor-result self (key-input self))
(application-decides-value self))
>
> Maybe the c-formula ... approach is completely the wrong way or that's
> not possible at all. I've read the documentation and primer but couldn't
> find anything helpful. Sorry, I'm new to cells.
No problem. This is a common case where one really wants to think
procedurally and it gets to be a little fun thinking declaratively. But
really the interesting part is this change from user-owning to
application-owning mode, so lemme know your protocol for that and I will
do what I can.
btw, as Jakub suggested often it is easier to divide and conquer:
(or (user-value self)
(application-decided-value self))
...but I think you will end up with the same issue at some point of
needing to know what state the field is in, so tell me more and I'll
give it a shot.
cheers, ken
ps. might make a good use case. k
Re: cells-qx rizing
2009-02-15 18:51:19 GMT
Am 15.02.2009 um 15:31 schrieb Kenneth Tilton: > stand back argentina: proof of concept is in hand for cells-qx > (cells + > qooxdoo). > > kt Oh man, can't wait to see the light ...Seriously: If you need a beta tester ... Cheers, Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo <at> me.com
Am 15.02.2009 um 15:31 schrieb Kenneth Tilton: > stand back argentina: proof of concept is in hand for cells-qx > (cells + > qooxdoo). > > kt Oh man, can't wait to see the light ...Seriously: If you need a beta tester ... Cheers, Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo <at> me.com
Re: c-formula and setf
2009-02-15 18:40:22 GMT
Hi Bastian, Am 15.02.2009 um 16:23 schrieb Bastian Müller: > Hi, > > I don't know if that has been discussed yet, but I've several use > cases > where I want to do sth. like that: A cell should be calculated by a > formula if it isn't set to a value. I thought that's possible with > (c-formula (:inputp t) ... ), which does calculate the slot by a > formula > and can be setf, but how is it possible to unset the setf value and > let > cells calculate it again? > > Example: A textbox is by default calculated by a formula. If the user > enters sth. into it, that value is used. If the user clears the > field of > his input, the value should be calculated again. > > Maybe the c-formula ... approach is completely the wrong way or that's > not possible at all. I've read the documentation and primer but > couldn't > find anything helpful. Sorry, I'm new to cells. > > Cheers, > Bastian Hi Bastian (wow - another Cells user in Germany- We're three now) As Kenny and Jakub have suggested one common solution I find myself using from time to time is: (defmd frgo () (entered-value (c-in nil)) (value (c? (or (^entered-value) (computed-value))))) (defun computed-value () ;;; Just making a simple function that fakes a computed value 'computed) (defun test-it () (let ((self (make-instance 'frgo))) (format t "~&Entered value: ~s~%" (^entered-value)) (format t "~&Value: ~s~%" (^value)) (setf (^entered-value) 'entered) (format t "~&Entered value: ~s~%" (^entered-value)) (format t "~&Value: ~s~%" (^value)))) Cheers Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo <at> me.com
Hi Bastian, Am 15.02.2009 um 16:23 schrieb Bastian Müller: > Hi, > > I don't know if that has been discussed yet, but I've several use > cases > where I want to do sth. like that: A cell should be calculated by a > formula if it isn't set to a value. I thought that's possible with > (c-formula (:inputp t) ... ), which does calculate the slot by a > formula > and can be setf, but how is it possible to unset the setf value and > let > cells calculate it again? > > Example: A textbox is by default calculated by a formula. If the user > enters sth. into it, that value is used. If the user clears the > field of > his input, the value should be calculated again. > > Maybe the c-formula ... approach is completely the wrong way or that's > not possible at all. I've read the documentation and primer but > couldn't > find anything helpful. Sorry, I'm new to cells. > > Cheers, > Bastian Hi Bastian (wow - another Cells user in Germany- We're three now) As Kenny and Jakub have suggested one common solution I find myself using from time to time is: (defmd frgo () (entered-value (c-in nil)) (value (c? (or (^entered-value) (computed-value))))) (defun computed-value () ;;; Just making a simple function that fakes a computed value 'computed) (defun test-it () (let ((self (make-instance 'frgo))) (format t "~&Entered value: ~s~%" (^entered-value)) (format t "~&Value: ~s~%" (^value)) (setf (^entered-value) 'entered) (format t "~&Entered value: ~s~%" (^entered-value)) (format t "~&Value: ~s~%" (^value)))) Cheers Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo <at> me.com
Re: c-formula and setf
2009-02-16 16:36:29 GMT
Frank Goenninger wrote: Hi Frank, > (wow - another Cells user in Germany- We're three now) Heh. > As Kenny and Jakub have suggested one common solution I find myself > using from time to time is: > > (defmd frgo () > (entered-value (c-in nil)) > (value (c? (or (^entered-value) > (computed-value))))) > > (defun computed-value () ;;; Just making a simple function that fakes a > computed value > 'computed) > > (defun test-it () > (let ((self (make-instance 'frgo))) > (format t "~&Entered value: ~s~%" (^entered-value)) > (format t "~&Value: ~s~%" (^value)) > > (setf (^entered-value) 'entered) > (format t "~&Entered value: ~s~%" (^entered-value)) > (format t "~&Value: ~s~%" (^value)))) > That looks very good. When used with ":reader value" for the value slot and ":writer value" for the entered-value slot this works very well. Thanks a lot! Cheers, Bastian
Re: tcl event loop
2009-02-16 17:22:12 GMT
On 2/16/09, Andy Chambers <achambers.home <at> googlemail.com> wrote: > > "Long story. Tcl C API weak for keypress events. This gets dispatched > eventually thanks to DEFCOMMAND" > > Do you remember what this was all about? My first thought was that > perhaps tk only generated keypress events instead of splitting them > into keyup/keydown but the docs on the bind command seem to suggest > you can catch them seperately. Scrap that. I've just found another comment in the source that explains it more fully. Sorry for the noise. -- Andy
Seriously: If you need a beta tester ...
Cheers,
Frank
--
Frank Goenninger
Cell: +49 175 4321058
E-Mail: frgo <at> me.com
RSS Feed