On Sat, Jan 16, 2010 at 09:31:27PM +0100, Henrik Sarvell wrote:
> Just one final question, here is a gui example from the demo app:
> '((This) (list This (: nr) This (: sup) (: sup ort) (: pr))) )
> That last line seems to control what is shown in the columns of the
> search result list,
> that seems to imply some kind of convention at
> work since (if that is the case) a call to This will display the 'nm
> value, same goes for a plain (: sup) which will get the suppliers'
> name. Correct or not?
Absolutely correct. The above line puts a result list into the chart.
Each element of that list must be of the proper type which the GUI
element in that column expects.
The code in the demo app for producing a single GUI line goes on as
(gui 1 '(+DstButton) Dst)
(gui 2 '(+NumField))
(gui 3 '(+ObjView +TextField) '(: nm))
(gui 4 '(+ObjView +TextField) '(: nm))
(gui 5 '(+TextField))
(gui 6 '(+FixField) 2) ) ) )
These six fields are in sync with the above data line
This (: nr) This (: sup) (: sup ort) (: pr)
That is, 'This' goes to the '+DstButton', so that this button contains
the object, and can react appropriately to a click.
The second element is the item number (: nr), a plain integer which is
stored in a '+NumField'.
Then 'This' is passed again, this time to an '+ObjView' text field, a
field which holds an object and knows how to show it (here the name of
the object (: nm)), and how to react on a click (jump to that object).
Same goes for (: sup), the supplier. The '+ObjView' field displays the
supplier's name, and jumps to that supplier if clicked.
(: sup ort) is the city name in the supplier, a plain string. It is
passed to a '+TextField'.
(: pr) is the price and gets passed to a fixnum field with two decimal
digits '(+FixField) 2'.
> Btw I couldn't find the definition of (gui) despite doing a search in
> the whole library, where is it?
'gui' is a function that gets defined at runtime, differently depending
on whether the HTTP request is a GET or a POST. This happens in the
'let' statements in line 49 of "lib/form.l"
... ) )