# S

`(saveButton Exe)`
  A button with the label "Save". 'Exe' is the code that runs when the button is pressed.

          (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)`
  Creates a button with the label "Search" and takes an `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`
  +SexField displays a choice between "Male" or "Female" and stores T or 0 respectively, depending on what the user selects.

          ,"Sex" (gui '(+E/R +SexField) '(sex : home obj))

  See also +Map, gui and +TextField.

`+Sgn`
  "Signum" prefix for numeric fields causing negative number to show in red color.

`+ShowButton`
  This button generates HTML that is displayed outside of the current form. One way of using this is in report creation and similar tasks. An example of this can be found in the demo app:

            (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`
  +SymField interns the text entered.

`+SubE/R`
  This class refers to a relation in an object which is '+Link'ed or '+Join'ed from the current form's object. Here is an example:

         (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`
  +Set takes an argument function that is called each time the field in question is set to a value. For example, the following snippet can be used to convert user input to upper case:

          (gui '(+Set +TextField) uppc 30)

  See also +Val, +Fmt, Formatting.

`+Style`
  Adds a css class name to a GUI component.

          (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`.