DEFINE CLASS props AS COLLECTION oStyle=null *[2015/11/23 10:34:06] ndragan - must add it this way. Adding a member of its own class in .init * or with Add Object gives "insufficient stack space" PROCEDURE oStyle_access() IF isnull(this.oStyle) this.oStyle=CREATEOBJECT("props") ENDIF RETURN this.oStyle *--------------------------------------------------- PROCEDURE setAttribute(tcAttr, tcValue) LOCAL o IF NOT EMPTY(THIS.GETKEY(tcAttr)) o=THIS.ITEM(tcAttr) ELSE o=CREATEOBJECT("empty") ADDPROPERTY(o, "name", tcAttr) THIS.ADD(o,tcAttr) ENDIF ADDPROPERTY(o, "value", tcValue) *--------------------------------------------------- PROCEDURE GetAttribute(tcAttr) TRY o=THIS.ITEM(tcAttr) lcVal=GETPEM(o, "value") CATCH lcVal="" ENDTRY RETURN lcVal *--------------------------------------------------- PROCEDURE tostring() LOCAL loItem LOCAL c c="" FOR EACH loItem IN THIS FOXOBJ c = c + TEXTMERGE([ <<loItem.name>>="<<loitem.value>>"]) ENDFOR IF THIS.oStyle.COUNT>0 c = c + TEXTMERGE([ style="<<this.oStyle.toStyle()>>"]) ENDIF RETURN c *--------------------------------------------------- PROCEDURE toStyle() *-- dn 2015/11/20 separate version for items in the style="..." LOCAL c c="" FOR EACH loItem IN THIS FOXOBJ c = c + TEXTMERGE([<<loItem.name>>:<<loitem.value>>;]) ENDFOR RETURN c ENDDEFINENote the remark in the ostyle_access method. First I had a "add object oStyle as props", then removed that and had .init() with this.oStyle=createobject("props"). Both banged gloriously with "insufficient stack space", IOW I managed to have recursion before the object has finished building itself :). Now it doesn't happen every year now that I find something new that you can't do in fox :).