Ramarren wrote: > On Tue, Mar 24, 2009 at 4:04 PM, David Mattli <d...@mattli.us> wrote: >> (mk-entry >> :md-name :hostname >> :text (c-in "localhost") >> :max-length 20) > > You can add ":auto-update t" to mk-entry options. This will make it > update on every keypress. The comment in the source claims that this > is broken, but when I tried it worked for me, and I don't see a reason > why it should not work, it is just a callback like any other. > > To retrieve the value on button press you would have to either drop > down to gtk interface and read it from there. I don't thing there is a > reasonable way to manually trigger a callback, and it would require > getting the gtk side object pointer anyway... This doesn't seem to be > a very good idea, but here goes: > > (mk-button :md-name :go :label "Set hostname!" > :on-clicked (callback (widget event data) > (with-widget (w :hostname) > (with-integrity (:change) > (setf (value w) > (cgtk::get-gtk-string > (gtk-ffi::gtk-entry-get-text (id w)))))) > (trc "you clicked the button?!")))
I think this is the way to go. The other alternative offered by David, viz. to have the interested Cell also watch the button would be feasible but mean someone who cared about the hostname had to worry about which GUI elements can be used by the user to indicate they want it to take effect. Ewwwww. > > And I am not even sure what exactly arguments to with-integrity do. They get more interesting when we have to control the order in which observers fire, which happens in my experience when I am driving something like Tcl/Tk or Qooxdoo (a JS app framework) which itself is sensitive to the order in which things happens. Understandable, but a step down from Cells which arranges for information to be ready JIT so we need not worry about it. btw, If this version of Cells-Gtk is built on the latest Cells the with-integrity call can be omitted (but is harmless) because the SETF code will notice no one is managing integrity and take over integrity management itself. kt > > Regards, > Jakub Higersberger > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel@common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.238 / Virus Database: 270.11.26/2020 - Release Date: 03/24/09 > 09:19:00 > _______________________________________________ cells-gtk-devel site list cells-gtk-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cells-gtk-devel