ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* placing an MPGraphic/Lines over multiple table cells
@ 2019-01-05 14:09 Martin Althoff
  0 siblings, 0 replies; only message in thread
From: Martin Althoff @ 2019-01-05 14:09 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2843 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 4020 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-05 14:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-05 14:09 placing an MPGraphic/Lines over multiple table cells Martin Althoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).