Hi Konrad,
I have a few questions regarding the class Field.
1) can I use it in a chart and if so what should I set the first
Yes. A '+ClassField' refers to an object's class, so it makes sense in a
chart holding a list of objects.
argument to I know this should be the object that I want the class of.
In a chart, you can in general access the data of the current line with
the 'curr' function.
For example, if we take your model from the previous mail
(class +Master +Entity)
(rel children (+List +Link) (+Child))
(rel name (+String)) # I added a 'name' to have more useful data
and have a form holding a '+Master' object, we might build a chart for
the children, one object per line:
(gui '(+E/R +Chart) '(children : home obj) 5
'((This) (list NIL This (: nm)))
car )
(table NIL NIL
'(NIL (NIL Class) (NIL Name))
(do 6
(row NIL
(gui 1 '(+ChoButton) '(choMaster (field 1)))
(gui 2 '(+ClassField) '(curr)
'((Armour +Armour +Item) (Weapon +Weapon +Item )) )
(gui 3 '(+TextField))
(gui 4 '(+DelRowButton))
(gui 5 '(+BubbleButton)) ) )
(scroll 6 T)
This assumes you have a typical 'choMaster' function to find/select
master objects (because otherwise you can't fill the chart).
Note: If you have a newer PicoLisp (= 3.0.9.3), you can simplify the
second column
(gui 1 '(+ChoButton) '(choMaster (field 1)))
to
(choMaster 1)
2) my instances have prefix classes, so what would be the correct
syntax for name class mapping list is it
'((Armour +Armour +Item) (Weapon +Weapon +Item ))
Yes. I used that above.
'((Armour (+Armour +Item)) (Weapon (+Weapon +Item)))
and not this one. The CDR of each element should give the type (i.e.
list of classes).
3) what should I put in the above list of options for Form rows that are
empty?
I'm not sure if I correctly understand the question. Enpty rows are no
problem for the chart, but other parts of the application code should be
prepared to handle NIL elements in the list. If you don't want to handle
it in the app, you can also make a '+Val' prefix to the '+Chart' and
filter the NIL elements.
(gui '(+E/R +Val +Chart) '(children : home obj)
'((L) (filter bool L))
5
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe