Hello,

  allow me to repost Pete Kirkham's compact non-XML
syntax comments and sample posted to xml-dev.

   Here we go:

[...]
Would the 'lisp' form support macros? You can get some
way towards having the code look like the gui if you
do (see example below). It also would seem more
natural to use keyword symbols rather than @foo for
the lisp form.
[...]

  --
;; example use of macros to build gui

;; some reusable macros
(defmacro cbxen (&rest labels) `(hbox ,(mapcar (lambda
(label) `(checkbox :label ,label)) labels)))
(defmacro gbx (id caption &rest contents) `(groupbox
,id (caption :label ,caption) ,@(macroexpand
contents)))

(defmacro horizontally (&rest widgets) `(hbox
,@(macroexpand `(buildwidgets ,@widgets))))
(defmacro vertically (&rest widgets) `(vbox
,@(macroexpand `(buildwidgets ,@widgets))))
(defmacro buildwidgets (&rest widgets)
  (mapcar (lambda (widget)
            (cond ((stringp widget) `(label :value
,widget))
                  (T (macroexpand widget))))
          widgets))

;; this expands to the example gui (modulo a nested
hbox)
(macroexpand
 '(gbx bedView
       "Ordering Your New Bed"
       (horizontally "Name:" (textbox name )
"Address:" (textbox address :cols 30 ))

       (horizontally "City:"  (textbox city ) "State:"
(textbox state :cols 2 )
                     "Zipcode:"  (textbox zip :cols 5
) "Customer Code:" (password code :cols 8 ))

       (horizontally "Type of wood:" (choice woodtype
:list woodtype) "Size:"  (choice size :list size :type
radio ))
 
       (horizontally "Extras:" (cbxen "Footband"
"Drawers (for underneath)" "Casters" "Squeak proofing"
))
 
       (vertically
        "Please share any suggestions or comments with
us:"
        (textarea comments :rows 3 :cols 65 ))
 
       (horizontally (button submit :label "Order Bed"
) (button reset :label "Start Over" ))))  


   Any comments? 

  - Gerald

PS: Sorry if the formatting is a little messed up. 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
xul-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xul-talk

Reply via email to