1# The `behind` attribute 2 3The "**behind** *object*" attribute causes the object currently under 4construction to be drawn before the referenced *object*. 5 6Pikchr normally draws objects in the order that they appear in the 7input script. However, the "`behind`" attribute can be used to alter 8the drawing order so that boxes used to implement background colors 9or borders can be drawn before the objects they enclose, even though 10the background-boxes are specified after the objects they enclose. 11 12Consider this example: 13 14~~~ pikchr toggle 15 lineht *= 0.4 16 $margin = lineht*2.5 17 scale = 0.75 18 fontscale = 1.1 19 charht *= 1.15 20 down 21IN: box "Interface" wid 150% ht 75% fill white 22 arrow 23CP: box same "SQL Command" "Processor" 24 arrow 25VM: box same "Virtual Machine" 26 arrow down 1.25*$margin 27BT: box same "B-Tree" 28 arrow 29 box same "Pager" 30 arrow 31OS: box same "OS Interface" 32 box same with .w at 1.25*$margin east of 1st box.e "Tokenizer" 33 arrow 34 box same "Parser" 35 arrow 36CG: box same ht 200% "Code" "Generator" 37UT: box same as 1st box at (Tokenizer,Pager) "Utilities" 38 move lineht 39TC: box same "Test Code" 40 arrow from CP to 1/4<Tokenizer.sw,Tokenizer.nw> chop 41 arrow from 1/3<CG.nw,CG.sw> to CP chop 42 43 box ht (IN.n.y-VM.s.y)+$margin wid IN.wid+$margin \ 44 at CP fill 0xd8ecd0 behind IN 45# ^^^^^^^^^ 46#################################### 47 line invis from 0.25*$margin east of last.sw up last.ht \ 48 "Core" italic aligned 49 50 box ht (BT.n.y-OS.s.y)+$margin wid IN.wid+$margin \ 51 at Pager fill 0xd0ece8 behind IN 52# ^^^^^^^^^ 53####################################### 54 line invis from 0.25*$margin east of last.sw up last.ht \ 55 "Backend" italic aligned 56 57 box ht (Tokenizer.n.y-CG.s.y)+$margin wid IN.wid+$margin \ 58 at 1/2<Tokenizer.n,CG.s> fill 0xe8d8d0 behind IN 59# ^^^^^^^^^ 60####################################################### 61 line invis from 0.25*$margin west of last.se up last.ht \ 62 "SQL Compiler" italic aligned 63 64 box ht (UT.n.y-TC.s.y)+$margin wid IN.wid+$margin \ 65 at 1/2<UT,TC> fill 0xe0ecc8 behind IN 66# ^^^^^^^^^ 67############################################ 68 line invis from 0.25*$margin west of last.se up last.ht \ 69 "Accessories" italic aligned 70~~~ 71 72In the diagram above, the white 73component boxes are drawn first. Then the larger boxes that 74implement the various background colors are drawn relative to 75the component boxes. The "`behind`" attribute must be used to 76cause the background boxes to appear to be behind the component 77boxes. Click on the diagram to see the source text. Comments 78have been inserted into the source text to help identify the 79"`behind`" attributes amid all the others. 80