At 06:48 PM 1/19/2003 +0100, Patrick Gundlach wrote:
Dear ConTeXt users,

I'd like to have an interactive table of content in the header (at
least somewhere at the top of the page). It should have the current
section highlighted.

First I have defined an overlay and used it with \setupbackgrounds:

\defineoverlay[toc][{\coloredcontent}]
\setupbackgrounds[header][text][background=toc,frame=on,state=repeat]

But the \coloredcontent behaves weired. \def\coloredcontent{A\par BB} gets
typeset as ABB, \currentheadnumber always displays the same number
(even with \determineheadnumber[section] before
\getcurrentheadnumber) and \placecontent is completely ignored.


It should look like this:

            --------------
 section1   | section 2  |  section 3    section 4
-------------            ----------------------------


the current page holds some paragraphs of section 2. Now you click on
"section 4" and the display changes to:


                                       -------------
 section1     section 2     section 3  | section 4 |
----------------------------------------           --


I hope it is clear what I'd like to get. How could this be done?
since you're a programmer and mp lover, let's go for the hard way:

beware" \par in an hbox is ignored (so in case of an framed thing, set the align variable)

conforming s-pre-19 and metafun:

\setupinteractionmenu
[top]
[state=start,
frame=off,
color=,
contrastcolor=blue,
position=yes]

\setupbackgrounds
[page]
[background=highlight]

\defineoverlay
[highlight]
[\useMPgraphic{highlight}]

\startusableMPgraphic{highlight} % walking box

StartPage ;

def top_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
if (pp>0) and (rr>0) :
if rr = 2 : % the current active link
path q ; q := unitsquare xyscaled (ww,hh) shifted (xx,yy) ;
fill q withcolor red ;
draw q withpen pencircle scaled 1.5pt withcolor .5red ;
fi ;
fi ;
enddef ;

\MPmenubuttons{top}

StopPage ;

\stopusableMPgraphic

\startusableMPgraphic{highlight} % your email drawing

StartPage ;

path p ; p := origin -- cycle ;

def top_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
if (pp>0) and (rr>0) :
if rr = 2 : % the current active link
p := unitsquare xyscaled (ww,hh) shifted (xx,yy) ;
fi ;
fi ;
enddef ;

\MPmenubuttons{top}

draw
llcorner Field[Text][Top] --
(xpart llcorner p,ypart llcorner Field[Text][Top]) --
(xpart ulcorner p,ypart ulcorner Field[Text][Top]) --
(xpart urcorner p,ypart ulcorner Field[Text][Top]) --
(xpart lrcorner p,ypart llcorner Field[Text][Top]) --
lrcorner Field[Text][Top]
% dashed evenly scaled 2
withpen pencircle scaled 2pt
withcolor .5red ;

StopPage ;

\stopusableMPgraphic

\setupcolors

so, use the top area, and in case of backgrounds make sure that they are calculated each page (which is default for page backgrounds); search for 'repeat' in s-pre-*.tex files

Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to