The code is still crashing and it has something to do with how I'm using the class field.
It is creating a database object but the object is broken. So that it cannot then be edited. if I execute show on the object I get: (show This) {13} {13} level "0D" whos {11} -> {13} But what I want is {13} (+Armour +Item) level 0 whos {11} -> {13} I then end up in a situation where the broken object can be viewed "{13}" shows up as a value in the class list, but can't be edited. Pressing edit causes a problem due to the circular reference. regs Konrad On Fri, Mar 9, 2012 at 6:2tmPM, Alexander Burger <a...@software-lab.de> wrote: > Hi Konrad, > >> so here is the code I have so far: > > > As I don't have the setup to test it here, let me guess > >> (gui '(+Set +E/R +Chart) '((L) (filter bool L)) '(gear : home obj) 5 >> '((Itm) >> (with Itm) >> (list This (: nm) (diestr (: >> level) (: notes)))) > >> 1. the data I get back always has default empty strings for all >> fields. even when I fill things in. > > I see two problems > > 1. A paren too much after '(with Itm' > 2. The list to put into the row doesn't match the fields. I suspect > there should be another paren after 'level)' > > >> '((Data Itm) >> (cond >> (Itm >> (put!> Itm 'nm (cadr Data)) >> (put!> Itm 'level (caddr Data)) >> (put!> Itm 'notes (cadddr Data)) >> Data) >> ((car L) >> (new! (car Data) >> 'nm (cadr Data) 'level >> (diestr (caddr Data)) 'notes (cadddr Data)) ) ) ) ) > > '(car L)' is not right here. Should be '(car Data)'. > > >> 2. the underlying code keeps crashing on: >> >> (upd> This (val This) Val) >> >> where this is an external symbol which seems to be my new Item. >> and Val is '(+Weapon +Item). > > This is in the 'set!>' method, as called by the +ClassField. The values > of 'This' and 'Val' seem OK. What kind of error was it (i.e. the error > message)? > > Perhaps this is simply a follow-up error because of the above? > > > I would first try this cleaned-up version: > > (gui '(+Set +E/R +Chart) '((L) (filter bool L)) '(gear : home obj) 5 > '((Itm) > (with Itm > (list This (: nm) (diestr (: level)) (: notes)) ) ) > '((Data Itm) > (cond > (Itm > (put!> Itm 'nm (cadr Data)) > (put!> Itm 'level (caddr Data)) > (put!> Itm 'notes (cadddr Data)) > Data ) > ((car Data) > (new! (car Data) > 'nm (cadr Data) > 'level (diestr (caddr Data)) > 'notes (cadddr Data) ) ) ) ) ) > (<table> NIL NIL > '((NIL "Type") (NIL "Name") (NIL "Level") (NIL "Notes")) > (do 3 > (<row> NIL > (gui 1 '(+ClassField) '(curr) > '(("Armour" +Armour +Item) ("Weapon" +Weapon +Item) ("Item" > +Item)) > (gui 2 '(+TextField) 10) > (gui 3 '(+TextField) 4) > (gui 4 '(+TextField) 30) > (gui 5 '(+DelRowButton)) ) ) ) ) > (scroll 3 T) > > Note that I also moved '(scroll 3 T)' outside the table. Otherwise you > get illegal HTML. Instead, you might make a separate row with > > (<row> NIL (scroll 3 T)) > > after closing the '(do 3', i.e. outside the 'do' but still inside the > '<table>'. > > Cheers, > - Alex > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- read my mind at: http://the-willows.blogspot.com/ -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe