Hi all,

I would use fieldstack with \getbuffer and overlays... Why the following code doesn't work ? Is there another way to do that ?

TIA


Renaud

%%%%%%% stack.tex

\setupcolors[state=start]
\usemodule[pre-original]

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\StartFrame{\startFunnyText}
\def\StopFrame {\stopFunnyText }
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{} % initialize the text variable
\startuseMPgraphic{FunnyFrame}
picture p ; numeric o ; path a, b ; pair c ;
p := textext.rt(\MPstring{FunnyFrame}) ;
a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
o := BodyFontSize ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
b := a randomized (o/2) ;
fill b withcolor .85white ; draw b ;
c := center p ;
c := b intersectionpoint (c shifted (0,-o)--c shifted(0,o)) ;
p := p shifted (c-center p) ;
b := (boundingbox p) randomized (o/8) ;
fill b withcolor .85white ; draw b ;
draw p withcolor black;
setbounds currentpicture to a ;
\stopuseMPgraphic

\definelayer[bglayer][position=yes]
\setupbackgrounds[text][background=bglayer]
\setuplayer[bglayer][position=no,corner=bottom,height=\paperheight]


\starttext

\startbuffer[first]
  \setlayer[bglayer][x=.55\textwidth,y=.9\textheight,location=b]{
    \FrameTitle{Knuth}
    \StartFrame[width=.75\textwidth]
      \input knuth
    \StopFrame
  }
\stopbuffer
 
\startbuffer[second]
  \setlayer[bglayer][x=.625\textwidth,y=.8\textheight,location=b]{
    \FrameTitle{Zapf}
    \StartFrame[width=.75\textwidth]
      \input zapf
    \StopFrame
  }
\stopbuffer

\startbuffer[third]
  \setlayer[bglayer][x=.70\textwidth,y=.7\textheight,location=b]{
    \FrameTitle{Tufte}
    \StartFrame[width=.75\textwidth]
      \input tufte
    \StopFrame
  }
\stopbuffer

  \definesymbol[empty][]
  \definesymbol[one][{\getbuffer[first]}]
  \definesymbol[two][{\getbuffer[first,second]}]
  \definesymbol[three][{\getbuffer[first,second,third]}]


\Topic{Stacks \& Layers}

{\setupbodyfont[12pt]

\definefieldstack[sequence]
  [one,two,three]
  [frame=off,
   offset=none,
   clickin=JS(Walk_Field{sequence})]

{\fieldstack[sequence]}

\goto{next}[JS(Walk_Field{sequence})]
}

\stoptext