Creating a User Interface for Data Modification, Part 1

Set-up of the file

### Modify / add following lines:(allowed ("css/")
"@lib.css" "!treeReport" "!person")
(de person ())
(de go ()
(server 8080 "!person") )
(de person () 
(html 0 "Person" "@lib.css" NIL
(form NIL

Getting the database item

  1. Adding <id> to our form,
  2. Appending an *ID parameter to the URL.
(form NIL
(<h2> NIL (<id> (: nm)))

The +E/R prefix class

(gui '(+E/R +TextField) '(nm : home obj) 40 "Name")
"born" (gui '(+E/R +DateField) '(dat : home obj) 10)
"died" (gui '(+E/R +DateField) '(fin : home obj) 10)

The +ClassField form element

(gui '(+ClassField) '(: home obj) '(("Male" +Man) ("Female" +Woman))) )

The +Obj Prefix class

(gui '(+E/R +Obj +TextField) '(mate : home obj) '(nm +Person) 30) )
  1. Suggestions if we want to change the partner’s name (we’ll see that later in the edit mode!),
  2. A pencil that executes a predefined function if we click on it. If no function is specified, the url> method is taken.
### DB ###
(class +Person +Entity)
(rel nm (+Need +Sn +Idx +String)) # Name
(rel txt (+String)) # Info
(dm url> (Tab)
(list "!person" '*ID This) )

Creating a table using +Chart and <table>

(gui '(+E/R +Chart) '(kids : home obj) 7
'((This) (list NIL This (: dat) (: pa) (: ma)))
cadr )
  • '((This) (list NIL This (: dat) (: pa) (: ma))) creates a list of lists out of the (kids : home obj data, i. e. exactly one value per column and row.
  • cadr is equivalent to the second item of a list, which corresponds to the actual child object.
(<table> NIL NIL
'(NIL (NIL "Children") (NIL "born") (NIL "Father") (NIL "Mother"))
(do 6
(<row> NIL
(choPerson 1)
(gui 2 '(+Obj +TextField) '(nm +Person) 20)
(gui 3 '(+Lock +DateField) 10)
(gui 4 '(+ObjView +TextField) '(: nm) 20)
(gui 5 '(+ObjView +TextField) '(: nm) 20)
(gui 6 '(+DelRowButton))
(gui 7 '(+BubbleButton)) ) )
(<row> NIL NIL (scroll 6 T)) )

Output table finished!

(<grid> 4
"Occupation" (gui '(+E/R +TextField) '(job : home obj) 20)
"Father" (gui '(+E/R +Obj +TextField) '(pa : home obj) '(nm +Man) 30)
"born" (gui '(+E/R +DateField) '(dat : home obj) 10)
"Mother" (gui '(+E/R +Obj +TextField) '(ma : home obj) '(nm +Woman) 30)
... )

Setting a default starting point

$ family-edit.l -family~main +
family: (set *DB '{A12})
-> {A12}
family: (show *DB)
{1} {A12}
+Woman {3}
+Person {2}
+Man {4}
-> {1}
(when (app)
(redirect (baseHRef) *SesId *Url "?*ID=" (ht:Fmt (val *DB))) )
html 0 (; *ID nm) "@lib.css" NIL



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mia Temma

Mia Temma

These are cross-posts from my blog I’m writing about PicoLisp for beginners. Welcome!