Hi Olaf,

you are quite close, I think.

The 'keyA' relation has a small problem

> (class +Foo +Entity)
> (rel keyA (+Ref +Number) 2)
> (rel keyB (+Ref +String))

'+Ref' takes an optional argument, and '2' should be for '+Number',
so correct would be

   (rel keyA (+Ref +Number) NIL 2)

Then, instead of using Pilog

> (solve '( @F Floor
> @C Ceil
> (db keyA (@F . @C) @FooObj) )
> @FooObj) )

you could also simply (collect 'keyA '+Foo) to get a list of
all objects.

Note, however, that both 'solve' and 'collect' are not so wise if the
database has many '+Foo' objects, because they return _all_ objects and
thus the chart may become huge.

For displaying a possibly infinite number of objects in a chart, it is
better to use '+QueryChart' which displays just the first page of hits
and then lets you scroll down as far as you like. Examples for
+QueryChart can be found in "doc/family.l" and "app/gui.l".

Besides this, your approach

> (gui '(+Init +Chart) (getFooObjs 5 100) 3

is not bad or wrong at all. However, the '+Lock' prefixes in

   (gui 1 '(+Lock +NumField) 10)

make the fields non-editable.

Thus,I would try something like

   (gui '(+Init +Chart) (collect 'keyA '+Foo) 2
      '((This) (list (: keyA) (: keyB)))
      '((L D)
         (when D
            (put!> D 'keyA (car L))
            (put!> D 'keyB (cadr L))
            D ) ) )
   (<table> NIL NIL
      '((NIL "KeyA") (NIL "KeyB"))
         (do 8
            (<row> NIL
               (gui 1 '(+NumField) 10)
               (gui 2 '(+TextField) 10) ) ) )
   (scroll 8 T)

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to