Re: clg-CVS

Christophe Rhodes <[email protected]>
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
On Mon, Mar 25, 2002 at 10:52:34AM +0100, Espen S Johnsen wrote:
> Christophe Rhodes <[email protected]> writes:
> 
> > There's some stuff at <http://www-jcsu.jesus.cam.ac.uk/~csr21/clg/>, all
> > bar one of which works, I think -- it's a start of the translation of
> > the GTK tutorial into clg.
> 
> Nice, I have only looked briefly at your examples (I'm in a bit of
> hurry, going on vacation in a couple of hours) so I don't know what is
> working and what is not. But I noticed your use reinitialize-instance to
> add children to containers; the preferred method is to either use
> container-add or a :parent initarg when creating the children. For
> boxes, a third option is the box-pax function.

OK -- is there any reason for this? Is it that reinitializing the
instance is likely to be expensive? It would be a shame to ban that
outright...

> > The one that doesn't work doesn't because it wasn't obvious to me how to
> > subclass widgets -- I was getting whinges from validate-superclass...
> 
> Subclassing of widgets is not yet possible, but I am planning to
> implement this (which was one of the main reasons why I decided to make
> use of the MOP) when the main bindings are done.
>  
> > I haven't looked at things for a while -- do the bindings run with 2.0?
> 
> Yes, at least 2.0.0 is required. A lot of bindings is still missing but
> I am working on it, and hope have make an alpha release in the near
> future.

Great!

I've attached a (small) example file to this message that I hope would
also qualify as an example.  I guess that list-stores are among the
missing objects, which is why I've used a combo here; feel free to make
any use of the code you wish (not that I think it has much value beyond
simple pedagogy... :)

Cheers,

Christophe
-- 
Jesus College, Cambridge, CB5 8BL                           +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/                  (defun pling-dollar 
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)
apropos.lisp (text/plain, 1.5 KB)
(in-package "GTK")

(defun external-symbol-p (symbol)
  (multiple-value-bind (symbol status)
      (find-symbol (symbol-name symbol) (symbol-package symbol))
    (assert (not (member status '(nil :inherited))))
    (eq status :external)))

(defparameter *apropos-list* nil)
(defparameter *apropos-list-changed* nil)

(defparameter *apropos-combo*
  (make-instance 'combo
     :popdown-strings nil))

(defparameter *apropos-window*
  (make-instance 'window
    :show-all t
    :child *apropos-combo*))
    
(defparameter *master-window*
  (make-instance 'window
    :show-all t
    :title (format nil "Apropos - ~a/~a" (lisp-implementation-type) (machine-type))
    :child 
    (make-instance 'frame
	     :label "Apropos:"
	     :child (make-instance 'v-box
		      :child (make-instance 'entry
			       :label "Apropos string:"
			       :signal (list 'activate
					     (lambda (entry)
					       (setf *apropos-list* (apropos-list (entry-text entry)))
					       (combo-set-popdown-strings *apropos-combo* (mapcar #'string *apropos-list*)))
					     :object t))
		      :child (make-instance 'toggle-button
			       :label "External symbols only"
			       :signal (list 'clicked
					     (lambda (button)
					       (if (toggle-button-active-p button)
						   (combo-set-popdown-strings *apropos-combo* (mapcar #'string (remove-if-not #'external-symbol-p *apropos-list*)))
						   (combo-set-popdown-strings *apropos-combo* (mapcar #'string *apropos-list*))))
					     :object t))))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.