(saveButton Exe)
(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))) ) )
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.
(searchButton Exe)
Exe
argument. Here is an example from the demo app included with the PicoLisp
distribution, in gui.l.
(searchButton '(init> (: home query)))
This is from one of the search dialogs and is given '(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.
+SexField
,"Sex" (gui '(+E/R +SexField) '(sex : home obj))
See also +Map, gui and +TextField.
+Sgn
+ShowButton
(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))) ) ) ) ) ) ) )
The above code from inventory.l produces a CSV file with the current
inventory. See also +Button.
+SymField
+SubE/R
(class +Instr +Entity)
(rel foo (+Joint) ins (+Foo))
(rel ma (+String))
(rel ha (+String))
A +Foo
object may have an +Instr
object. The
+Instr
object in turn has two +String
properties,
'ma' and 'ha'. Using +SubE/R
allows us to write this in the GUI
of +Foo
:
(gui '(+SubE/R +TextField) '(ma ins +Instr) 30)
(gui '(+SubE/R +TextField) '(ha ins +Instr) 30)
This makes it possible to edit 'ma' and 'ha' from the +Instr
-
object in the GUI for the +Foo
- object, and no separate form is
needed for +Instr
.
+Set
(gui '(+Set +TextField) uppc 30)
See also +Val, +Fmt, Formatting.
+Style
(gui '(+Style +View +TextField) "mono"
'(pack
(make
(for Col (: home grid)
(for This Col
(link (if (: life) "X " " ")) )
(link "^J") ) ) )
40 20 )
In this example, the class "mono" is added to a +TextField
.