[cells-gtk-cvs] CVS update: public_html/cgtk-primer.html public_html/faq.html

Peter Denno pdenno at common-lisp.net
Sat Oct 1 19:03:17 UTC 2005


Update of /project/cells-gtk/cvsroot/public_html
In directory common-lisp.net:/tmp/cvs-serv12344

Modified Files:
	cgtk-primer.html faq.html 
Log Message:
a few more FAQ answers.
Date: Sat Oct  1 21:03:16 2005
Author: pdenno

Index: public_html/cgtk-primer.html
diff -u public_html/cgtk-primer.html:1.3 public_html/cgtk-primer.html:1.4
--- public_html/cgtk-primer.html:1.3	Mon Mar  7 00:37:35 2005
+++ public_html/cgtk-primer.html	Sat Oct  1 21:03:15 2005
@@ -147,7 +147,7 @@
 propagation to formula-valued cell dependencies has to happen before any output 
 SETF (and why Cells has a mechanism to defer SETFs of inputs).
 
-<h1>Family: Referencing slots throughout the defmodel hierarchy.</h1>
+<h1>Family: Referencing cells throughout the defmodel hierarchy.</h1>
 
 The <strong>defmodel</strong> macro defines a part-subpart relationship 
 among components of the interface. The relationship is made by the
@@ -160,7 +160,7 @@
 <address><a href="mailto:peter.denno at nist.gov">Peter Denno</a></address>
 <!-- Created: Thu Mar  3 18:45:35 EST 2005 -->
 <!-- hhmts start -->
-Last modified: Sun Mar  6 18:36:16 EST 2005
+Last modified: Sun Mar  6 18:43:09 EST 2005
 <!-- hhmts end -->
 </div>
 </body>


Index: public_html/faq.html
diff -u public_html/faq.html:1.7 public_html/faq.html:1.8
--- public_html/faq.html:1.7	Mon Mar  7 00:38:22 2005
+++ public_html/faq.html	Sat Oct  1 21:03:15 2005
@@ -36,18 +36,22 @@
       <li><a href="#q6">What GTK Widgets are implemented in cells-gtk?</a></li>
       <li><a href="#q7">Do I have to use cells?</a></li>
       <li><a href="#q8">What is libcellsgtk.so about?</a></li>
+      <li><a href="#q8.5">What is the difference between using c-in and c? in a slot's :initform?</a></li>
       <li><a href="#q9">Why do I need :owner here? It looks like c? would bind self to the mk-whatever
                     enclosing the c?</a></li>
       <li><a href="#q10">How do I do xyz?</a></li>
-      <li><a href="#q11">Q: What does this error mean? : "cellular slot FOO of #<BAR 21B555A4> cannot be setf 
-                    unless initialized as inputp.</a></li>
-      <li><a href="#q12">Q: Changing a cell value causes dependencies to fire, but what is considered a change?</li>
+      <li><a href="#q11">What does this error mean? : "cellular slot FOO of #<BAR 21B555A4> cannot be setf 
+                    unless initialized as inputp."</a></li>
+      <li><a href="#q12">Changing a cell value causes dependencies to fire, but what is considered a change?</li>
+      <li><a href="#q13">Can I keep a window around for redisplay after using the window border 
+                            'delete' button to delete it?</a></li>
+
     </ul>
 
 <p/>
 
 <strong id="q1">Q: What is Cells-GTK?</strong><p/>
-<strong>A:</strong> Cells-GTK is a GTK binding to lisp written by Vasilis Margioulas. It uses the 
+<strong>A:</strong> Cells-GTK is a lisp binding of GTK written by Vasilis Margioulas. It uses the 
 Cells system, a sort of constraint propagation system written by kenny tilton.
 (see "What is Cells?"). As of this writing Cells-GTK runs under Allegro, Lispworks 
 and CMUCL. A separate distribution (not quite up to date with the former) runs 
@@ -56,7 +60,39 @@
 <strong id="q2">Q: What is Cells?</strong><p/>
 <strong>A:</strong> From the Cells website: "Cells is a mature, stable extension to CLOS that allows you 
    to create classes, the instances of which have slots whose values are determined by 
-   a formula."
+   a formula." 
+<p/> Here is an explanation from the viewpoint of a Cells-GTK programmer:
+   Cells provides Cells-GTK with two essential features: (1) a part-subpart relationship,
+   as is typically found in GUIs -- it allows the user to express that, e.g., this window contains these 
+   buttons and subwindows etc.; (2) the expression of a program's state machine, as viewed from the 
+   context of the user's interaction through the GUI. This last point is especially noteworthy, and 
+   needs more explanation. If you are at all familiar with developing moderately complex software
+   that is operated through a GUI, then you have probably learned this: Keeping what is presented through 
+   the GUI in-sync with what the user is allowed to do, and in-sync with the computational state of 
+   the program is often tedious, complicated work. Specifically, there are the issues of what menu items 
+   ought to be made sensitive when, what items should be presented in list, what text should appear in
+   entries, etc. Cells-GTK helps with these tasks by providing an abstraction over the details; each
+   of the tasks just listed can be controlled by (a) rules that specify the value of attributes of graphic 
+   features in the part-subpart declaration  (that declaration is called 'defpart' in cells-gtk); 
+   and, (b) rules that specify the value of CLOS slots. [Footnote, In the details of the implementation, 
+   (a) is just a usage of (b). But it helps to think of the ability to set a GUI feature with a
+   rule as something different than setting the value of slot with a rule.]. An example of (a)
+   is setting the :sensitive feature of a GTK menu item. For this, I might use the rule (c? (user-file *my-gui*)).
+   Here user-file is the accessor of some object *my-gui*. :sensitive is a boolean, so whenever there
+   is a non-nil value in the slot user-file, the menu item is sensitive. That doesn't look a whole lot 
+   different than giving :sensitive whatever value (user-file *my-gui*) evaluates to.
+   The difference is that in Cells-GTK, the Cells codes watches over 'instrumented' slots such as user-file 
+   and automatically updates those attributes of a Cell-GTK object (such as a menu item's :sensitive feature) 
+   that are governed by a Cells rule. Thus, I don't have to explicitly update the value of 
+   :sensitive -- it happens automatically. 
+   <p/>
+   So what is this talk about 'expression of a program's state machine?' Well, the idea is that 
+   in a GUI operated by Cells-GTK, transition into a state is governed by cells-rules on 
+   GUI features and cells-instrumented slots. E.g. when the user loads a file, (c? (user-file *my-gui*))
+   becomes true and the program enters the state where some menu item that wasn't sensitive now is 
+   -- the cells rules are rules on the arcs out of states. Is that stretching it too much? 
+   I don't know, it makes sense to me.
+   <p/>
    See also:
     <ul>      
        <li><a href="http://common-lisp.net/project/cells/">
@@ -68,6 +104,7 @@
     </ul>
 
 <p/>
+
 <strong id="q3">Q: Why is the Clisp distribution separate?</strong><p/>
 <strong>A:</strong> Because as of this writing, UFFI, which Cells-GTK uses, doesn't support CLISP.
 <p/>
@@ -82,7 +119,22 @@
 <p/>
 <strong id="q6">Q: What GTK Widgets are implemented in cells-gtk?</strong><p/>
 <strong>A:</strong> [hmm, Better to ask what isn't. Most of the useful widgets are implemented, but
-    among those, many non-essential methods are not.]
+    among those, many non-essential methods are not.] A quick look at the 
+<a href="http://developer.gnome.org/doc/API/2.0/gtk/ch02.html">widget gallery</a>. These
+are not implemented:
+<ul>
+  <li>GtkColorButton</li>
+  <li>GtkFileChooserButton </li>
+  <li>GtkFontButton </li>
+  <li>GtkIconView</li>
+  <li>GtkStatusBar</li>
+  <li>GtkFontSelectionDialog</li>
+  <li>GtkColorSelectionDialog</li>
+</ul>
+<p/>There are quite a few other widgets not listed in the Gallery that aren't implmented.
+But BTW, it isn't difficult to implement most of these. If you need one, implemented
+it and drop us a note!
+
 <p/>
 <strong id="q7">Q: Do I have to use cells?</strong><p/>
 <strong>A:</strong> Probably not. But the demo uses them, so it might still be (despite the lack of 
@@ -143,6 +195,14 @@
   the libgtk.so you are using. 
 
 <p/>
+
+<p/>
+<strong id="q8.5">Q: What is the difference between using c-in and c? in a slot's :initform ?</strong><p/>
+<strong>A:</strong> The usual semantics of :initform do not apply when :initform is given a c? rule.
+Instead of just setting the value at initialization, when c? is used, the value of the slot is
+checked and updated using the rule throughout program execution.
+<p/>
+
 <strong id="q9">Q: Why do I need :owner here? It looks like c? would bind self to the mk-whatever
    enclosing the c?</strong><p/>
 <tt>
@@ -179,7 +239,7 @@
 </pre>
 </tt>
 <p/>
-<strong>A:</strong> If you macroexpand callback, you will see that ith binds self again, this time to the 
+<strong>A:</strong> If you macroexpand callback, you will see that it binds self again, this time to the 
    menu-item. <br/><tt>(owner self)</tt> gets you into the :kids hierarchy. 
 <p/>
 <strong id="q10">Q: How do I do xyz?</strong><p/>
@@ -200,6 +260,25 @@
      dependencies to fire again (in order to save substantial useless recalculations). So how is 
      "equivalence" defined? EQL is used unless overridden by providing a function of two arguments 
      to :unchanged-if in the slot definition of the defmodel. 
+
+
+<p/>
+<strong id="q13">Q: Can I keep a window around for redisplay after using the window border 
+                    'delete' button to delete it?</strong><p/>
+   <strong>A:</strong>Yes. Do something like this:
+
+<tt>
+<pre>
+(defmodel pseudo-dialog (window)
+  ()
+  (:default-initargs
+   :on-delete-event (callback (w e d) (gtk-widget-hide-on-delete w))))
+</pre>
+</tt>
+<p/>
+... and, of course, store the widget somewhere so you can later display it with
+ (gtk-widget-show-all (widget-id my-pseudo-dialog)).
+
 
 <hr/>
 <address><a href="mailto:peter.denno at nist.gov">Peter Denno</a></address>




More information about the Cells-gtk-cvs mailing list