Hi Konrad,
> Sorry I should add to my last message that when I actually navigate to
> the page with the Chart code I listed I get the following error:
>
> (D Pre)
> D -- Undefined
>
> The underlying record has no skills as yet. The
> ...
> My Latest linkage of data to GUI is related to a Bag Relation
>
> On the DB side I have
>
> (class +Monster +Entity)
> (rel skills (+List +Bag) (((+String)) ((+Number))))
Here is one nesting level too much. Please try
(rel skills (+List +Bag) ((+String)) ((+Number)))
> and on the Web side I Have
> (gui '(+E/R +Chart) '(skills : home obj) 2)
> (<grid> 2
> "Skill" "level"
> (do (+ (length (get *ID 'skills)) 1)
> (gui 1 '(+TextField) *Skills)
> (gui 2 '(+TextField) diestr diestr 5)))
>
>
> Note diestr translates between the Number and a string representation
> of the number. Like other such functions
> found in standard picolisp it works in both directions.
Good. Note that you might simply use '+NumField' instead.
More notes:
1. Instead of referring to '*ID" in (get *ID 'skills), I would write
(: obj skills)
The reason ist that '*ID' is valid only the first time the page is
called, but not necessarily when you revisit that form with the
browser back button, or from other tabs etc.
Note that (: obj x) is used while on the form level, while (: home
obj x) is used on the field level.
2. Making the size of the +Chart depending on the length of the list is
a bit inflexible, as this list may change dynamically, and especially
in the beginning it is normally zero. I would simply take some
constant value.
3. While editing the contents of a chart, you will also want to delete a
row, or exchange the order of rows. For that, I almost always add a
'+DelRowButton' (delete a row) and a '+BubbleButton' (exchange two
rows).
4. If you want a more flexible HTML table, you could use <table> instead
of <grid>, giving you more control over the table's caption and
individual colums.
5. If we take a constant number of rows (see (2)), we must be prepared
that the list in the chart gets longer then fits into those rows.
Therefore, I usually put scroll buttons at the bottom with the
'scroll' function.
With all that, your chart becomes:
(gui '(+E/R +Chart) '(skills : home obj) 4)
(<table> NIL NIL '((NIL "Skill") (NIL "level"))
(do 8
(<row> NIL
(gui 1 '(+TextField) *Skills)
(gui 2 '(+NumField) 5)
(gui 3 '(+DelRowButton))
(gui 4 '(+BubbleButton)) ) ) )
(scroll 8 T)
The '4' in the first line must give the number of columns in the chart,
and the '8' for 'scroll' should usually match the number of rows for 'do'.
(not tested)
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe