The above code is an example from the code running the PicoLisp wiki, in gui.l. The button is passed a code argument that checks if a reply has been written to the current object, creating markup code and syncing the database. In effect, an entire "miniature program" is connected to the save button to be run when someone clicks it. See also +Button.
(saveButton '(let Obj (: home obj) (when (: home org) # Reply (dbSync) (put> (: home org mup) 'rpl (append (: home org mup rpl) (cons (setq Obj (new (db: +Doc) '(+Doc)))) ) ) (commit 'upd) ) (apply 'newMup> (: home mup) Obj) (off *ID) (url (ext.html (or (: home org) Obj))) ) )
Exeargument. Here is an example from the demo app included with the PicoLisp distribution, in gui.l.
This is from one of the search dialogs and is given
(searchButton '(init> (: home query)))
'(init> (: home query))as argument. When the search button if pressed, the argument code is run. In this case, the pilog query in the search dialog is initiated. See also +Rid, +JS, +Tip, +Button.
See also +Map, gui and +TextField.
,"Sex" (gui '(+E/R +SexField) '(sex : home obj))
The above code from inventory.l produces a CSV file with the current inventory. See also +Button.
(gui '(+ShowButton) NIL '(csv ,"Inventory" (<table> 'chart NIL (<!> (quote (align) (NIL ,"Description") (align ,"Inventory") (NIL ,"Supplier") NIL (NIL ,"Zip") (NIL ,"City") (align ,"Price") ) ) (catch NIL (pilog (quote @Rng (cons *InvFrom (or *InvTill T)) @Nm *InvNm @Sup *InvSup (select (@Item) ((nr +Item @Rng) (nm +Item @Nm) (sup +Item @Sup)) (range @Rng @Item nr) (part @Nm @Item nm) (same @Sup @Item sup) ) ) (with @Item (<row> (alternating) (<+> (: nr) This) (<+> (: nm) This) (<+> (cnt> This)) (<+> (: sup nm) (: sup)) (<+> (: sup nm2)) (<+> (: sup plz)) (<+> (: sup ort)) (<-> (money (: pr))) ) ) (at (0 . 10000) (or (flush) (throw))) ) ) ) ) ) ) )
(class +Instr +Entity) (rel foo (+Joint) ins (+Foo)) (rel ma (+String)) (rel ha (+String))
+Fooobject may have an
+Instrobject in turn has two
+Stringproperties, 'ma' and 'ha'. Using
+SubE/Rallows us to write this in the GUI of
This makes it possible to edit 'ma' and 'ha' from the
(gui '(+SubE/R +TextField) '(ma ins +Instr) 30) (gui '(+SubE/R +TextField) '(ha ins +Instr) 30)
+Instr- object in the GUI for the
+Foo- object, and no separate form is needed for
See also +Val, +Fmt, Formatting.
(gui '(+Set +TextField) uppc 30)
In this example, the class "mono" is added to a
(gui '(+Style +View +TextField) "mono" '(pack (make (for Col (: home grid) (for This Col (link (if (: life) "X " " ")) ) (link "^J") ) ) ) 40 20 )