+obj
+obj
is a base class used to turn a DB object into a first
class GUI item. See +Obj, +ObjView and +ObjVal.
+Obj
+Obj
supplies suggestions from the database, using
dbHint
.
(gui '(+E/R +Obj +TextField) '(pa : home obj) '(nm +Man) 30)
Here, the +TextField
is connected to the 'pa'- property of the
current form object. Since we are using +Obj
in combination
with +TextField
, the database will suggest names from the 'nm'-
property of the class +Man
. See also +NumField, +DateField, dbHint, +hint, +obj.
+ObjView
+Obj
, but not editable (view-only). Therefore it
is free to display an arbitrary attribute of an object, or even the result
of an arbitrary formatting expression, while still allowing to click on it
and jump to the object's GUI form, as determined by the url>- method (or
a custom method supplied as an optional argument to +ObjView
.
Such an optional method is accepted by all subclasses of +obj
).
A common use of +ObjView
is when presenting data in a
chart
. Given the following 'put'- function:
'((This) (list This This (: pa) (: ma) (: mate) (: job) (: dat)))
The data can be displayed with the following table:
(<table> 'chart NIL
'((btn) (NIL "Name") (NIL "Father") (NIL "Mother") (NIL "Partner") (NIL "Occupation") (NIL "born"))
(do (cho)
(<row> (alternating)
(gui 1 '(+DstButton) Dst)
(gui 2 '(+ObjView +TextField) '(: nm))
(gui 3 '(+ObjView +TextField) '(: nm))
(gui 4 '(+ObjView +TextField) '(: nm))
(gui 5 '(+ObjView +TextField) '(: nm))
(gui 6 '(+TextField))
(gui 7 '(+DateField)) ) ) )
Columns 2, 3 and 4 use +ObjView
to display the name of the 'pa',
'ma' and 'mate' relations of the current object respectively. See also +Obj, +obj.
+ObjVal
+Obj
, but automatically creates a new object if one
does not exist and an attribute value is entered into a field. See also +Obj, +obj.
+OnClick
(gui '(+OnClick +Button) "alert('OK')" "Alert")
The PicoLisp wiki includes a good article that
explains +OnClick in depth. See also +Button
and gui.
(okButton 'Exe)