[cells-devel] Re: Celtk: setting the content of a text widget ? Fileevent working !

Frank Goenninger fgoenninger at prion.de
Sun May 21 21:30:36 UTC 2006


Am 21.05.2006 um 22:48 schrieb Ken Tilton:

> I took your stuff and whittled it down to:
>
> (defobserver .md-value ((self text-widget))
>   (trc "md-value output" self new-value)
>   (with-integrity (:client `(:variable ,self))
>     (tk-format-now "~a delete 1.0 end" (^path))
>     (when (plusp (length new-value))
>       (tk-format-now "~a insert end ~s" (^path) new-value))))
>
> That way two (setf (md-value self) "Hi mom") calls do not produce  
> "Hi momHi mom".

Hm, yes, but ... ;-)

This changes behavior. Ok, I never really said anywhere anything  
about the implied behavior ... <g>

Now, whenever the model is set the whole text widget gets cleared and  
then the whole widget is set again. Which brings me to the "Hi mom"  
example above: I actually wanted the widget to behave that way. Now,  
seeing what you made of it,  I see the need to really broaden the API  
to the text widget to have APPEND and SET functions for the model.

> I was not sure  the API entry point CLEAR was needed elsewhere. I  
> can see that it would be, though. Really, the more I look at the  
> text widget  the more I think it needs imperative processing by  
> application code that has a clear idea of what it wants to do with  
> all the capabilities of the widget.

hehe, exactly. As I said above...

> I also brought both commands within the same integrity bundle by  
> skipping the tk-format syntactic sugar and open-coding with- 
> integrity. That just saves one enqueue, no big deal. A bigger deal  
> is that the sort done by tk-user-queue-handler was not (until just  
> now <g>) a stable sort, so the delete could have been executed  
> after the insert. Bringing both operations into the single  
> integrity bundle also fixes that.

Oookkaaayy....

> $ echo "Heya this is a test" > /Users/frgo/tmp/frgo-test
>
> the text gets displayed in the window.
>
> Isn't great when we get stuff like that working? Is there a  
> universal law: any time the effect produced by your own code  
> surprises you, you are probably onto something good. Programming  
> never gets old.

Right. Which is why we sit here after finishing our 2 hours of  
ballroom dancing on Sunday evening writing Cells code and emails like  
crazy. My wife is in bed already so I can pretend there's noone  
feeling bad about me sitting in the home office room here... <g>

>
>
> Fileevent to be put to Celtk CVS in a few days ... watch out.
>
> Thx. I am switching all my code to LLGPL now, btw. I think we  
> settled on that for your stuff, yes?

Well, yeah, LLPPL or MIT is just fine.

>
> kt

Frank





More information about the cells-devel mailing list