(change Msg Env Exe Exe)
When this button is pressed, 'doSomething' is executed with the results of (makeNewValue) and (getCurrentValue). The tooltip of the undo-button will show "Undo: 'Some change action'". The redo-stack is cleared and the redo-button is disabled.
(gui '(+UndoButton)) (gui '(+RedoButton)) ... (gui '(+Button) "Do something" '(change "Some change action" (env 'New (makeNewValue) 'Old (getCurrentValue)) # Build environment (restoreValue Old) # Undo-expression (doSomething New) ) ) # Do-expression
If now the undo-button is pressed, 'undoSomething' is executed with the saved results of (foo) and (bar). It should perform the opposite action of 'doSomething', effectively undoing the operation. The tooltip of the redo-button will now show "Redo: 'Some change action'", and the tooltip of the undo-button will show a possible previous undoable operation. Pressing the redo-button will *do* the operation again, and so on.See also +UndoButton, +RedoButton.
(chart) # chart (chart 'data 1) # The first line (list) of the chart's data.
+ChoButtonis quite a general class. It can be used to select, or even do, anything. See also choButton, +Tiny, +Tip, +Button.
+ChoButton. Opens a
dialogthat allows the user to choose anything from a list, which is dynamically generated from the 'Exe' argument. See also +ChoButton, dialog.
chois a function that returns the number 16 if the
diaformis used as a normal form (i.e. not as a dialog) or 8 if used in another context. It is typically used to show a different number of rows in a chart when the same chart is used as a dialog compared to when it is used on it's own. The following code fragment comes from the demo app included in the PicoLisp distribution, in gui.l. Here we can see
chobeing used to determine how many rows of data should be created, as well as making sure scrolling the data goes along with the number of rows.
See also diaform.
. . (do (cho) (<row> (alternating) (gui 1 '(+DstButton) Dst) (gui 2 '(+NumField)) (gui 3 '(+ObjView +TextField) '(: nm)) (gui 4 '(+TextField)) (gui 5 '(+MailField)) (gui 6 '(+TextField)) (gui 7 '(+TextField)) (gui 8 '(+TelField)) (gui 9 '(+TelField)) ) ) ) (<spread> (scroll (cho)) . .
(choTtl Ttl X . @)
choTtlis a utility function typically used to set the title of a chart in a search dialog. The function combines a transient symbol, a text string, with the number of objects of a given type in the database. Here is an example from the demo app included in the PicoLisp distribution, in gui.l.
This example specifies an index, "...'nr '+CuSu)", and counts the number of
(choTtl ,"Customers/Suppliers" 'nr '+CuSu)
+CuSuobjects in that index. The result is combined with "Customers/Suppliers", setting the title of the data chart to, for example, "3 Customers/Suppliers". It is also possible to specify only the class, "... '+CuSu)". In that case the total number of entities of that class is used, regardless of any index.
(choDlg Dst Ttl Rel [Hook] [((+XyzField) ..) Exe Able])
choDlg, "choose dialog" creates a dialog that lets the user select or create an object, to be either jumped to (when called as a form), or taken into the destination field (when called as a dialog, see +DstButton). The following example comes from the demo app included with the PicoLisp distribution, in cusu.l. This file implements a form that handles objects of a class called
+CuSuis connected to another class,
+Sal, "Salutation". Using a
choDlgin cusu.l allows a user to add or change the salutation belonging to the current object from the same GUI page used to edit other properties.
This code creates a
,"Salutation" (choDlg 0 ,"Salutations" '(nm +Sal))
choDlgthat presents objects of the class
diaform. Selecting an object in the choose dialog will close the dialog and adopts the selected value as the new salutation. See also diaform.
+Autoto automatically click a button after a certain amount of time has passed. Strictly speaking,
+Clickis not limited to
+Autobuttons, but that is the most common usage.
See also +Auto, +Button.
(gui '(+Click +Auto +Button) 420 'This 1000 '(pop *Throbber) '(with (: home) (for Col (: grid) (for This Col (let N # Count neighbors (cnt '((Dir) (get (Dir This) 'life)) (quote west east south north ((X) (south (west X))) ((X) (north (west X))) ((X) (south (east X))) ((X) (north (east X))) ) ) (=: next # Next generation (if (: life) (>= 3 N 2) (= N 3) ) ) ) ) ) (for Col (: grid) # Update (for This Col (=: life (: next)) ) ) ) )
+Chkin combination with the built-in validation from
+NumFieldto only accept numbers not bigger than 9.
(app) (action (html 0 "+Chk" "@lib.css" NIL (form NIL (gui '(+Chk +NumField) '(or (extra) (and (> (val> This) 9) "Number too big") ) 12 ) (gui '(+JS +Button) "Print" '(msg (val> (field -1))) ) ) ) )
+Chartis a number:
This number tells the chart how many columns of data to expect. As can be seen in the code snippet above, the number '2' matches the number of gui components in the table. To make it possible for a
(gui (+Chart) 2) (<table> NIL NIL '((NIL "Text") (NIL "Number")) (do 1 (<row> NIL (gui 1 '(+TextField) 20) (gui 2 '(+NumField) 10) ) ) )
+Chartto display data in a representation that is different from how the date is stored, you may pass two functions to a
+Chart. The functions in question are a 'put' and a 'get' function, and they are responsible for 'translating' the data format between the gui and the internal representation. The first function is a 'put'- function that puts data into the GUI components from the internal representation and the second one is a 'get'- function gets data from the GUI components into the internal representation.
All GUI components that follow a chart and that have a number as their first argument go into that chart. Typically, the components are arranged in a
(gui '(+E/R +Chart) '(bin : home obj) 3 '((This) (list (: nm))) # 'Put'- function '((L D) # 'Get'- function (and D (put!> D 'nm (car L))) D ) ) (<table> NIL "Binaries" '((NIL "Name")) (do 6 (<row> NIL (gui 1 '(+Able +TextField) '(curr) 30) (gui 2 '(+DelRowButton)) (gui 3 '(+BubbleButton)) ) ) )
<table>but this is not a requirement. Any suitable layout works just as well. See also charts, +Chart1, +QueryChart and gui.
The example above comes from the code running the PicoLisp wiki, in gui.l. In this code, a
(gui '(+Var +Chart1) (: mup -3) 3) (<table> 'chart NIL '((NIL "Media")) (do 3 (<row> (alternating) (gui 1 '(+ObjView +TextField) '(: nm)) # Binary name (gui 2 '(+DelRowButton)) (gui 3 '(+BubbleButton)) ) ) (<row> NIL (scroll 3 T)) )
+Chart1handles the data provided by
(: mup -3)and the chart expects 3 columns. 'mup' is setup a little earlier in the code:
'mup' is a list here, and
(=: mup (list (and (: obj mup) (in (blob @ 'txt) (till NIL T))) # txt NIL # sum NIL # min (: obj mup bin) ) )
(: mup -3)picks
(: obj mup bin)from there. 'list' is applied as the 'put'- function, resulting in a list containing what is stored in the 'bin' property of the markup contained in the current object. In the table displaying the data, a combination of +ObjView and +TextField is used to create a link to the object:
(gui 1 '(+ObjView +TextField) '(: nm))See also +Chart, charts.
,"Hotel?" (gui '(+E/R +Checkbox) '(htl : home obj))
+Checkboxmaps to a bool (T or NIL). In the example above, the 'htl' property of the current object will contain T or NIL, depending on whether the checkbox in the gui has been ticked or not. See also gui, +field and input fields.
+ClassFieldis used to display and change the class of an object .
The example above displays and changes a person's sex from male to female and vice versa. See also +Map, +TextField.
(gui '(+ClassField) '(: home obj) '(("Male" +Man) ("Female" +Woman)))
clone>- method (inherited from
+Entity). See also +Rid, +Able, +Tip and +Button.
(closeButton Lbl 'Exe)
Causes an empty field to display "<Please enter some text here>".
(gui '(+Cue +TextField) "Please enter some text here" 30)
... (<table> 'chart NIL '((NIL ,"File") (NIL ,"Delete")) (do 2 (<row> NIL (gui 1 '(+DocObj +TextField) (curr)) # (gui 2 '(+DelRowButton)) ) ) ) ...