I am trying to place some lines in "Z" shape over several cells of a table. This single "Z" has the intention of blocking manual alterations to the table in empty cells. The cells to blocked are always a coherent rectangle. I hope that makes sense.

In the example below, the table with 4 rows, 3 columns has content in column one only, the other 2 columns should have the "Z". Placing the blocking "Z" into every cell is not an option due to formal requirements.

What I attempted below a) seems very cumbersome b) doesn't work (the small "Z" doesn't fill the frame).

While I can easily place a "Z" into a single cell (in the example), I can't figure out how to cover multiple cells. Furthermore, I would need to do a lot of calculations to figure out the multiple layer placements, column positions, etc. With multiple tables on a page, several pages, that seems error prone.

Any suggestions, corrections, hints are most welcome!

Kindly, Martin


Working example with some comments:

% Graphic that draws the "Z", that works fine in a single table cell as seen in the example
\startuseMPgraphic{ZRule}
rulethickness:= \frameddimension{rulethickness}*3;

drawoptions(
    withpen pencircle scaled rulethickness
    withcolor \MPcolor{\framedparameter{framecolor}});

pair topleftcorner, toprightcorner;
topleftcorner := (rulethickness, \overlayheight-rulethickness-1.5mm);
toprightcorner:= (\overlaywidth-rulethickness, \overlayheight-rulethickness-1.5mm);

pair lowerleftcorner, lowerrightcorner;
lowerleftcorner := (rulethickness, rulethickness+1.5mm);
lowerrightcorner:= (\overlaywidth-rulethickness, rulethickness+1.5mm);


draw topleftcorner -- toprightcorner;
draw lowerleftcorner -- lowerrightcorner;
draw toprightcorner -- lowerleftcorner;
\stopuseMPgraphic

\defineoverlay[ZRule][\useMPgraphic{ZRule}]

\starttext

\setupTABLE[c][each][width=30mm]
\setupTABLE[r][each][width=6mm]

% in an attempt to place the table at known positions, I put it into a layer. Though it is not really "background".
\definelayer[datatable][x=0mm, y=0mm,width=\textwidth, height=25mm]
\setlayer[datatable][hoffset=0mm, voffset=0mm]{

\bTABLE
\bTR
\bTD content1  \eTD \bTD  \eTD \bTD  \eTD
\eTR
\bTR
\bTD content  \eTD \bTD  \eTD \bTD  \eTD
\eTR
\bTR
\bTD content  \eTD \bTD \eTD \bTD  \eTD
\eTR
\bTR
\bTD content  \eTD \bTD[background=ZRule]  \eTD \bTD  \eTD
\eTR
\eTABLE

}

% Now trying to create another layer covering the table area where the "Z" should go.
\definelayer[ZStrike][x=32mm, y=0mm,width=60mm, height=24mm]
% The "Z" fails to reach full size of the frame
\setlayer[ZStrike][hoffset=0mm, voffset=0mm]{\framed[frame=on,width=60mm,height=24mm]{\useMPgraphic{ZRule}}}

% arrange the "background" layers
\setupbackgrounds[text][background={datatable,foreground,ZStrike}]

\blank[force, 28mm]


further content

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to