interaction-widgets.tex /size: 24 Kb    last modification: 2020-07-01 14:35
1\environment interaction-style
2
3\startcomponent interaction-widgets
4
5\startchapter[title={Widgets}]
6
7    {\em This chapter will discuss forms and special buttons.}
8
9\stopchapter
10
11\stopcomponent
12
13% Below comes from the old widgets manual:
14
15\def\fillinfield#1{}
16
17% \useJSscripts[fld]
18% \setupinteraction[state=start,closeaction=ForgetAll]
19
20\section{Fill||in fields}
21
22Fields come in many disguises. Currently \CONTEXT\ supports
23the field types provided by \PDF, which in turn are derived
24from \HTML. Being a static format and not a programming
25language, \PDF\ only provides the interface. Entering data
26is up to the viewer and validation to the built in
27\JAVASCRIPT\ interpreter. The next paragraph shows an
28application.
29
30\startbuffer
31A few years back, \TEX\ could only produce \fillinfield [dvi]
32{\DVI} output, but nowadays, thanks to \fillinfield {Han The
33Thanh}, we can also directly produce \fillinfield [pdf] {\PDF}!
34Nice eh? Actually, while the first field module was prototyped
35in \ACROBAT, the current implementation was debugged in
36\fillinfield [pdfTeX] {\PDFTEX}. Field support in \fillinfield
37[ConTeXt] {\CONTEXT} is rather advanced and complete and all
38kind of fields are supported. One can hook in appearances, and
39validation \fillinfield [JavaScripts] {\JAVASCRIPT}'s. Fields
40can be cloned and copied, where the latter saves some space. By
41using \fillinfield {objects} when suited, this module saves
42space anyway.
43\stopbuffer
44
45\getbuffer
46
47This paragraph is entered in the source file as:
48
49\typebuffer
50
51I leave it to the imagination of the user how
52\type{\fillinfield} is implemented, but trust me, the
53definition is rather simple and is based on the macros
54mentioned below.
55
56Because I envision documents with many thousands of fields,
57think for instance of tutorials, I rather early decided to
58split the definition from the setup. Due to the fact that
59while typesetting a field upto three independant instances
60of \type{\framed} are called, we would end up with about
61150~hash entries per field, while in the current
62implementation we only need a few. Each field can inherit
63its specific settings from the setup group it belongs to.
64
65Let's start with an example of a {\em radio} field. In fact
66this is a collection of fields. Such a field is defined
67with:
68
69\startbuffer
70\definefield
71  [Logos] [radio] [LogoSetup]
72  [ConTeXt,PPCHTEX,TeXUtil] [PPCHTEX]
73\stopbuffer
74
75\typebuffer
76
77\getbuffer
78
79Here the fourth argument specifies the subfields and the
80last argument tells which one to use as default. We have to
81define the subfields separately:
82
83\startbuffer
84\definesubfield [ConTeXt] [] [ConTeXtLogo]
85\definesubfield [PPCHTEX] [] [PPCHTEXLogo]
86\definesubfield [TeXUtil] [] [TeXUtilLogo]
87\stopbuffer
88
89\typebuffer
90
91\getbuffer
92
93The second argument specifies the setup. In this example
94the setup (\type {LogoSetup}) is inherited from the main
95field. The third arguments tells \CONTEXT\ how the fields
96look like when turned on. These appearances are to be
97defined as symbols:
98
99\startbuffer
100\definesymbol [ConTeXtLogo] [{\externalfigure[mp-cont.502]}]
101\definesymbol [PPCHTEXLogo] [{\externalfigure[mp-cont.503]}]
102\definesymbol [TeXUtilLogo] [{\externalfigure[mp-cont.504]}]
103\stopbuffer
104
105\typebuffer
106
107\getbuffer
108
109Before we typeset the fields, we specify some settings to use:
110
111\startbuffer
112\setupfield [LogoSetup]
113  [width=4cm,
114   height=4cm,
115   frame=off,
116   background=screen]
117\stopbuffer
118
119\typebuffer
120
121\getbuffer
122
123Finally we can typeset the fields:
124
125\startbuffer
126\hbox to \hsize
127  {\hss\field[ConTeXt]\hss\field[PPCHTEX]\hss\field[TeXUtil]\hss}
128\stopbuffer
129
130\typebuffer
131
132This shows up as:
133
134\startbaselinecorrection
135\getbuffer
136\stopbaselinecorrection
137
138An important characteristic of field is cloning cq.\
139copying, as demonstrated below:
140
141% \tracefieldstrue
142
143\startbuffer[symbol]
144\definesymbol [yes-a] [$\times$]
145\definesymbol [yes-b] [$\star$]
146\definesymbol [nop-a] [$\bullet$]
147\definesymbol [nop-b] [$-$]
148\stopbuffer
149
150\getbuffer[symbol]
151
152\startbuffer[define]
153\definefield [example-1] [radio] [setup 1] [ex-a,ex-b,ex-c] [ex-c]
154\definesubfield [ex-a,ex-b,ex-c] [setup 1] [yes-a,nop-a]
155\stopbuffer
156
157\getbuffer[define]
158
159\startbuffer[clone]
160\clonefield [ex-a] [ex-p] [setup 2] [yes-b,nop-b]
161\clonefield [ex-b] [ex-q] [setup 2] [yes-b,nop-b]
162\clonefield [ex-c] [ex-r] [setup 2] [yes-b,nop-b]
163\stopbuffer
164
165\getbuffer[clone]
166
167\startbuffer[copy]
168\copyfield [ex-a] [ex-x]
169\copyfield [ex-b] [ex-y]
170\copyfield [ex-c] [ex-z]
171\stopbuffer
172
173\getbuffer[copy]
174
175\startbuffer[setup]
176\setupfield [setup 1] [width=1cm,height=1cm,framecolor=red]
177\setupfield [setup 2] [width=.75cm,height=.75cm]
178\stopbuffer
179
180\getbuffer[setup]
181
182\startbuffer[field]
183\hbox to \hsize
184  {\field[ex-a]\hfil\field[ex-b]\hfil\field[ex-c]\hfil\hfil
185   \field[ex-p]\hfil\field[ex-q]\hfil\field[ex-r]\hfil\hfil
186   \field[ex-x]\hfil\field[ex-y]\hfil\field[ex-z]}
187\stopbuffer
188
189\startbaselinecorrection \getbuffer[field] \stopbaselinecorrection
190
191The next table shows the relations between these fields of type radio:
192
193\startbaselinecorrection
194\showfields
195\stopbaselinecorrection
196
197This table is generated by \type {\showfields} and can be
198used to check the relations between fields, but only when
199we have set \type {\tracefieldstrue}. Radio fields have the
200most complicated relationships of fields, due to the fact
201that only one of them can be activated (on). By saying
202\type {\logfields} one can write the current field
203descriptions to the file \type {fields.log}.
204
205Here we used some \TEX\ mathematical symbols. These are
206functional but sort of dull, so later we will define a more
207suitable visualization.
208
209\typebuffer[symbol]
210
211The parent fields were defined by:
212
213\typebuffer[define]
214
215and the clones, which can have their own appearance, by:
216
217\typebuffer[clone]
218
219The copies are defined using:
220
221\typebuffer[copy]
222
223using the setups
224
225\typebuffer[setup]
226
227Finally all these fields are called using \type {\field}:
228
229\typebuffer[field]
230
231Now we will define a so called {\em check} field. This
232field looks like a radio field but is independant of
233others. First we define some suitable symbols:
234
235\startbuffer
236\definesymbol [yes] [{\externalfigure[mp-cont.502]}]
237\definesymbol [no]  []
238\stopbuffer
239
240\getbuffer
241
242\typebuffer
243
244A check field is defined as:
245
246\startbuffer
247\definefield [check-me] [check] [setup 3] [yes,no] [no]
248\stopbuffer
249
250\getbuffer
251
252\typebuffer
253
254This time we say \type{\field[check-me]} and get:
255
256\startbuffer
257\setupfield
258  [setup 3]
259  [width=2cm, height=2cm,
260   rulethickness=3pt, corner=round, framecolor=red]
261\stopbuffer
262
263\getbuffer
264
265\startlinecorrection
266\hbox to \hsize{\hss\field[check-me]\hss}
267\stoplinecorrection
268
269As setup we used:
270
271\typebuffer
272
273We already saw an example of a {\em line} field. By default
274such a line field looks like:
275
276\startbuffer[define]
277\definefield [Email] [line] [ShortLine] [] [pragma@wxs.nl]
278\stopbuffer
279
280\getbuffer[define]
281
282\startbuffer[field]
283\field [Email] [your email]
284\stopbuffer
285
286\startbaselinecorrection \getbuffer[field] \stopbaselinecorrection
287
288We defined this field as:
289
290\typebuffer[define]
291
292and called it using a second, optional, argument:
293
294\typebuffer[field]
295
296As shown, we can influence the way such a field is typeset.
297It makes for instance sense to use a monospaced typeface
298and limit the height. When we set up a field, apart from
299the setup class we pass some general characteristics, and
300three more detailed definitions, concerning the
301surrounding, the label and the field itself.
302
303\startbuffer
304\setupfield
305  [ShortLine]
306  [label,frame,horizontal]
307  [offset=4pt,height=fit,framecolor=green,
308   background=screen,backgroundscreen=.80]
309  [height=18pt,width=80pt,align=middle,
310   background=screen,backgroundscreen=.90,frame=off]
311  [height=18pt,width=80pt,color=red,align=right,style=type,
312   background=screen,backgroundscreen=.90,frame=off]
313\stopbuffer
314
315\typebuffer
316
317So now we get:
318
319\getbuffer
320
321\startbuffer[mainmail]
322\definemainfield [MainMail] [line] [ShortLine] [] [pragma@wxs.nl]
323\stopbuffer
324
325\getbuffer[mainmail]
326
327\startlinecorrection
328\field [MainMail] [your email]
329\stoplinecorrection
330
331Such rather long definitions can be more sparse when we set
332up all fields at once, like:
333
334\startbuffer
335\setupfields
336  [label,frame,horizontal]
337  [offset=4pt,height=fit,framecolor=green,
338   background=screen,backgroundscreen=.80]
339  [height=18pt,width=80pt,
340   background=screen,backgroundscreen=.90,frame=off]
341  [height=18pt,width=80pt,color=red,align=middle,
342   background=screen,backgroundscreen=.90,frame=off]
343\stopbuffer
344
345\typebuffer
346
347So given that we have defined field \type {MainMail} we can
348say:
349
350\startbuffer[MP]
351\startuniqueMPgraphic{button}
352  path p ; p := fullcircle xyscaled (OverlayWidth,OverlayHeight) ;
353  fill p withcolor (.8,.8,.8) ;
354  draw p withcolor OverlayColor withpen pencircle scaled 3 ;
355\stopuniqueMPgraphic
356
357\defineoverlay [normalbutton] [\uniqueMPgraphic{button}]
358\stopbuffer
359
360\getbuffer[MP]
361
362\startbuffer
363\setupfield [LeftLine]
364  [background=normalbutton, backgroundcolor=darkgreen,
365   offset=2ex, height=7ex, width=.25\hsize,
366   style=type, frame=off, align=left]
367\setupfield [MiddleLine]
368  [background=normalbutton, backgroundcolor=darkgreen,
369   offset=2ex, height=7ex, width=.25\hsize,
370   style=type, frame=off, align=middle]
371\setupfield [RightLine]
372  [background=normalbutton, backgroundcolor=darkgreen,
373   offset=2ex, height=7ex, width=.25\hsize,
374   style=type, frame=off, align=right]
375
376\clonefield [MainMail] [LeftMail]   [LeftLine]
377\clonefield [MainMail] [MiddleMail] [MiddleLine]
378\clonefield [MainMail] [RightMail]  [RightLine]
379\stopbuffer
380
381\typebuffer
382
383\getbuffer
384
385We get get three connected fields:
386
387\startlinecorrection
388\hbox to \hsize
389  {\field[LeftMail]\hss\field[MiddleMail]\hss\field[RightMail]}
390\stoplinecorrection
391
392(Keep in mind that in \CONTEXT\ left aligned comes down to
393using \type {\raggedleft}, which can be confusing, but
394history cannot be replayed.)
395
396By the way, this shape was generated by \METAPOST\ using
397the overlay mechanism:
398
399\typebuffer[MP]
400
401Due to the fact that a field can have several modes (loner,
402parent, clone or copy), one cannot define a clone or copy
403when the parent field is already typeset. When one knows in
404advance that there will be clones or copies, one should
405use:
406
407\typebuffer[mainmail]
408
409Now we can define copies, clones and even fields with the
410same name, also when the original already is typeset. Use
411\type {\showfields} to check the status of fields. When in
412this table the mode is typeset slanted, the field is not
413yet typeset.
414
415The values set up with \type {\setupfield} are inherited by
416all following setup commands. One can reset these default
417values by:
418
419\startbuffer
420\setupfields[reset]
421\stopbuffer
422
423\typebuffer
424
425\getbuffer
426
427When we want more than one line, we use a {\em text} field.
428Like the previous fields, text must be entered in the
429viewer specific encoding, in our case, \PDF\ document
430encoding. To free users from thinking of encoding,
431\CONTEXT\ provides a way to force at least the accented
432glyphs into a text field in a for \TEX\ users familiar way:
433
434\setupfields
435  [horizontal]
436  [offset=4pt,height=fit,framecolor=green,
437   background=screen,backgroundscreen=.80]
438  [height=18pt,width=80pt,
439   background=screen,backgroundscreen=.90,frame=off]
440  [height=18pt,width=80pt,color=red,align=middle,
441   background=screen,backgroundscreen=.90,frame=off]
442
443\definefield
444  [SomeField] [text] [TextSetup]
445  [hi there, try \string\\ \string " e or
446   \string\\ \string~ n to get \"e or \~n]
447
448\setupfield
449  [TextSetup]
450  [label,frame,horizontal][framecolor=green][]
451  [height=80pt,width=240pt,style=\sl,align=middle,
452   enterregion=JS(Initialize_TeX_Key),
453   afterkey=JS(Convert_TeX_Key),
454   validate=JS(Convert_TeX_String)]
455
456\startbaselinecorrection
457\field[SomeField][Just Some Text]
458\stopbaselinecorrection
459
460Now, how is this done? Defining the field is not that hard:
461
462\starttyping
463\definefield [SomeField] [text] [TextSetup] [default text]
464\stoptyping
465
466The conversion is taken care of by a \JAVASCRIPT's. We can assign such
467scripts to mouse and keyboard events, like in:
468
469\starttyping
470\setupfield
471  [TextSetup][...][...][...]
472  [....,
473   regionin=JS(Initialize_TeX_Key),
474   afterkey=JS(Convert_TeX_Key),
475   validate=JS(Convert_TeX_String)]
476\stoptyping
477
478The main reason for using the \type{JS(...)} method here is
479that this permits future extensions and looks familiar at
480the same time. Depending on the assignments, one can
481convert after each keypress and|/|or after all text is
482entered.
483
484\startbuffer
485\definefield
486  [Ugly] [choice] [UglySetup]
487  [ugly,awful,bad] [ugly]
488\setupfield
489  [UglySetup]
490  [width=6em,
491   height=1.2\lineheight,
492   location=low]
493\stopbuffer
494
495\getbuffer
496
497We've arrived at another class of fields: {\em choice},
498{\em pop||up} and {\em combo} fields. All those are menu
499based (and \vbox{\field[Ugly]}). This in||line menu was
500defined as:
501
502\typebuffer
503
504\startbuffer
505\definefield
506  [Ugly2] [popup] [UglySetup]
507  [ugly,awful,bad] [ugly]
508\definefield
509  [Ugly3] [combo] [UglySetup]
510  [ugly,{AWFUL=>awful},bad] [ugly]
511\stopbuffer
512
513\getbuffer
514
515Pop||up fields look like: \vbox{\field[Ugly2]} and combo
516fields permit the user to enter his or her own option:
517\vbox{\field[Ugly3]}. The amount of typographic control
518over these three type of fields is minimal, but one can
519specify what string to show and what string results:
520
521\typebuffer
522
523Here \type{AWFUL} is shown and when selected becomes the
524choice \type{awful}. Just in case one wonders why we use
525\type{=>}, well, it just looks better and the direction
526shows what value will be output.
527
528\startbuffer[uglies]
529\definefieldset [AllUglies] [Ugly, Ugly2, Ugly3]
530\stopbuffer
531
532\getbuffer[uglies]
533
534\startbuffer
535One can for instance \goto {reset the form} [ResetForm] or
536\goto {part of the form} [ResetForm{AllUglies}]. This last
537sentence was typed in as:
538\stopbuffer
539
540A special case of the check type field is a pure {\em push}
541field. Such a field has no export value and has only use as
542a pure interactive element. For the moment, let's forget
543about that one.
544
545Before we demonstrate our last type of fields and show some
546more tricky things, we need to discuss what to do with the
547information provided by filling in the fields. There are
548several actions available related to fields.
549
550\getbuffer
551
552\typebuffer
553
554Hereby \type {AllUglies} is a set of fields to be defined
555on forehand, using
556
557\typebuffer[uglies]
558
559In a similar way one can \goto {submit some or all fields}
560[SubmitForm] using the \type {SubmitForm} directive. This
561action optionally can take two arguments, the first being
562the destination, the second a list of fields to submit, for
563instance:
564
565\starttyping
566\button{submit}[SubmitForm{mailto::pragma@wxs.nl,AllUglies}]
567\stoptyping
568
569Once the fields are submitted (or saved in a file), we can
570convert the resulting \FDF\ file into something \TEX\ with
571the perl program \type{fdf2tex}. One can use \type
572{\ShowFDFFields{filename}} to typeset the values. If you do
573not want to run the \PERL\ converter from within \TEX, say
574\type {\runFDFconverterfalse}. In that case, the (stil)
575less robust \TEX\ based converter will be used.
576
577I already demonstrated how to attach scripts to events, but
578how about changing the appearance of the button itself?
579Consider the next definitions:
580
581\startbuffer
582\definesymbol [my-y] [$\times$]
583\definesymbol [my-r] [?]
584\definesymbol [my-d] [!]
585
586\definefield
587  [my-check] [check] [my-setup]
588  [{my-y,my-r,my-d},{,my-r,my-d}]
589\stopbuffer
590
591\typebuffer
592
593\getbuffer
594
595Here we omitted the default value, which always is {\em no}
596by default. The setup can look like this:
597
598\startbuffer
599\setupfield
600  [my-setup]
601  [width=1.5cm, height=1.5cm,
602   frame=on, framecolor=red, rulethickness=1pt,
603   backgroundoffset=2pt, background=screen, backgroundscreen=.85]
604\stopbuffer
605
606\typebuffer
607
608\getbuffer
609
610Now when this field shows up, watch what happens when the
611mouse enters the region and what when we click.
612
613\startbaselinecorrection
614\hbox to \hsize{\hss\field[my-check]\hss}
615\stopbaselinecorrection
616
617So, when instead of something \type{[yes,no]} we give
618triplets, the second element of such a triplet declares the
619roll||over appearance and the third one the push||down
620appearance. The braces are needed!
621
622One application of appearances is to provide help or
623additional information. Consider the next definition:
624
625\startbuffer
626\definefield [Help] [check] [HelpSetup] [helpinfo] [helpinfo]
627\stopbuffer
628
629\typebuffer
630
631\getbuffer
632
633This means as much as: define a check field, typeset this
634field using the help specific setup and let \type{helpinfo}
635be the on||value as well as the default. Here we use the
636next setup:
637
638\startbuffer
639\setupfields
640  [reset]
641\setupfield
642  [HelpSetup]
643  [width=fit,height=fit,frame=off,option={readonly,hidden}]
644\stopbuffer
645
646\typebuffer
647
648\getbuffer
649
650We didn't use options before, but here we have to make sure
651that users don't change the content of the field and by
652default we don't want to show this field at all. The actual
653text is defined as a symbol:
654
655\startbuffer
656\definesymbol [helpinfo] [\SomeHelpText]
657
658\def\SomeHelpText%
659  {\framed
660     [width=\leftmarginwidth,height=fit,align=middle,style=small,
661      frame=on,background=color,backgroundcolor=white,framecolor=red]
662     {Click on the hide button to remove this screen}}
663\stopbuffer
664
665\typebuffer
666
667\getbuffer
668
669\startbuffer
670\inmargin {\fitfield[Help]} Now we can put the button somewhere and
671turn the help on or off by saying \goto {Hide Help} [HideField{Help}]
672or \goto {Show Help} [ShowField{Help}]. Although it's better to put
673these commands in a dedicated part of the screen. And try \goto
674{Help} [JS(Toggle_Hide{Help})].
675\stopbuffer
676
677\getbuffer
678
679We can place a field anywhere on the page, for instance by
680using the \type {\setup...texts} commands. Here we simply
681said:
682
683\typebuffer
684
685When one uses for instance \type {\setup...texts}, one
686often wants the help text to show up on every next page.
687This can be accomplished by saying:
688
689\starttyping
690\definemainfield [Help] [check] [HelpSetup] [helpinfo] [helpinfo]
691\stoptyping
692
693Every time such a field is called again, a new copy is
694generated automatically. Because fields use the
695objectreference mechanism and because such copies need to
696be known to their parent, field inclusion is a multi||pass
697typesetting job (upto 4 passes can be needed!).
698
699When possible, appearances are shared between fields,
700mainly because this saves space, but at the cost of extra
701object references. This feature is not that important for
702straight forward forms, but has some advantages when
703composing more complicated (educational) documents.
704
705Let us now summarize the commands we have available for
706defining and typesetting fields. The main definition macro
707is:
708
709\setup{definefield}
710
711and for radiofields we need to define the components by:
712
713\setup{definesubfield}
714
715Fields can be cloned and copied, where the latter can not
716be set up independently.
717
718\setup{clonefield}
719
720\setup{copyfield}
721
722Fields can be grouped, and such a group can have its own
723settings. Apart from copied fields, we can define the
724layout of a field and set options using:
725
726\setup{setupfield}
727
728Such a group inherits its settings from the general setup
729command:
730
731\setup{setupfields}
732
733Fields are placed using one of:
734
735\setup{field}
736
737or
738
739\setup{fitfield}
740
741Some pages back I showed an example of:
742
743\setup{fillinfield}
744
745Finally there are two commands to trace fields. These
746commands only make sense when one already has said: \type
747{\tracefieldstrue}.
748
749\setup{showfields}
750
751\setup{logfields}
752
753\section{Tooltips}
754
755\startbuffer
756Chinese people seem to have no problems in recognizing their many
757different pictorial glyphs. \tooltip [left] {Western} {European
758and American} people however seem to have problems in understanding
759what all those \tooltip [middle] {icons} {small graphics} on their
760computer screens represent. But, instead of standardizing on a set
761of icons, computer programmers tend to fill the screen with so
762called tooltips. Well, \tooltip {\CONTEXT} {a \TEX\ macro package}
763can do tooltips too, and although a good design can do without them,
764\TEX\ at least can typeset them correctly.
765\stopbuffer
766
767\getbuffer
768
769The previous paragraph has three of such tooltips under
770{\em western}, {\em icons} and {\em \CONTEXT}, each aligned
771differently. We just typed:
772
773\typebuffer
774
775This is an official command, and thereby we can show its
776definition:
777
778\setup{tooltip}
779
780\section{Fieldstacks}
781
782In due time I will provide more dedicated field commands.
783Currently apart from \type {\fillinfield} and \type
784{\tooltip} we have \type {\fieldstack}. Let's spend a few
785words on those now.
786
787\startbuffer[somemap1]
788\useexternalfigure [map -- -- --] [euro-10] [width=.3\hsize]
789\useexternalfigure [map nl -- --] [euro-11] [map -- -- --]
790\useexternalfigure [map nl de --] [euro-12] [map -- -- --]
791\useexternalfigure [map nl de en] [euro-13] [map -- -- --]
792
793\definesymbol [map -- -- --] [{\externalfigure[map -- -- --]}]
794\definesymbol [map nl -- --] [{\externalfigure[map nl -- --]}]
795\definesymbol [map nl de --] [{\externalfigure[map nl de --]}]
796\definesymbol [map nl de en] [{\externalfigure[map nl de en]}]
797
798\stopbuffer
799
800\startbuffer[somemap2]
801\definefieldstack
802  [somemap]
803  [map -- -- --, map nl -- --, map nl de --, map nl de en]
804  [frame=on]
805\stopbuffer
806
807\startbuffer[somemap3]
808\placefigure
809  [left][fig:somemap]
810  {Do you want to see what interfaces
811   are available? Just click \goto
812   {here} [JS(Walk_Field{somemap})]
813   a few times!}
814  {\fieldstack[somemap]}
815\stopbuffer
816
817\getbuffer[somemap1,somemap2,somemap3]
818
819One can abuse field for educational purposes. Take for
820instance \in{figure}[fig:somemap]. In this figure we can
821sort of walk over different alternatives of the same
822graphic. This illustration was typeset by saying:
823
824\typebuffer[somemap3]
825
826However, before we can ask for such a map, we need to
827define a field set, which in fact is a list of symbols to
828show. This list is defined using:
829
830\typebuffer[somemap2]
831
832which in turn is preceded by:
833
834\typebuffer[somemap1]
835
836\startbuffer
837\placefigure
838  [here][fig:anothermap]
839  {Choose \goto {one} [JS(Set_Field{anothermap,2})] country,
840   \goto {two} [JS(Set_Field{anothermap,3})] countries,
841   \goto {three} [JS(Set_Field{anothermap,4})] countries or
842   \goto {no} [JS(Set_Field{anothermap,1})] countries at all.}
843  {\fieldstack
844     [anothermap]
845     [map -- -- --, map nl -- --, map nl de --, map nl de en]
846     [frame=on]}
847\stopbuffer
848
849\getbuffer
850
851A slightly different illustration is shown in
852\in{figure}[fig:anothermap]. Here we use the same symbols
853but instead say:
854
855\typebuffer
856
857As one can see, we can can skip the definition and pass it
858directly, but I wouldn't call that beautiful.
859
860The formal definitions are:
861
862\setup{definefieldstack}
863
864\setup{fieldstack}
865
866Instead if stacking fields, you can of course also put them
867alongside. This makes sense when you want to use dedicated
868(visible) captions for each image.
869
870\startbuffer
871\useexternalfigure [europe]  [euro-10] [width=.3\hsize]
872\useexternalfigure [holland] [euro-nl] [europe]
873\useexternalfigure [germany] [euro-de] [europe]
874\useexternalfigure [england] [euro-en] [europe]
875
876\definesymbol [europe]  [{\externalfigure[europe]}]
877\definesymbol [holland] [{\externalfigure[holland]}]
878\definesymbol [germany] [{\externalfigure[germany]}]
879\definesymbol [england] [{\externalfigure[england]}]
880
881\definefield
882  [interface] [radio] [map]
883  [england,germany,holland] [holland]
884
885\definesubfield [holland] [] [holland,europe]
886\definesubfield [germany] [] [germany,europe]
887\definesubfield [england] [] [england,europe]
888
889\setupfield[map][frame=off]
890\stopbuffer
891
892\typebuffer
893
894\getbuffer
895
896We can for instance typeset the fields by saying:
897
898\startbuffer
899\startcombination[3]
900  {\fitfield[holland]} {Dutch Interface}
901  {\fitfield[germany]} {German Interface}
902  {\fitfield[england]} {English Interface}
903\stopcombination
904\stopbuffer
905
906\typebuffer
907
908\startbaselinecorrection
909\getbuffer
910\stopbaselinecorrection
911
912
913
914%D \starttyping
915%D \defineviewerlayer[test]
916%D
917%D \startviewerlayer[test]Hide Me\stopviewerlayer
918%D
919%D \defineoverlay
920%D   [WithTest]
921%D   [{\overlayrollbutton[HideLayer{test}][VideLayer{test}]}]
922%D
923%D \framed[background=WithTest]{toggle}
924%D \stoptyping
925
926
927
928% \setupinteraction[state=start]
929%
930% \definepushbutton [reset]
931%
932% \startuniqueMPgraphic{whatever}{color}
933%     fill fullcircle xysized (OverlayWidth,OverlayHeight) withcolor \MPvar{color} ;
934% \stopuniqueMPgraphic
935%
936% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=red}]
937% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=green}]
938% \definepushsymbol [reset] [d] [\uniqueMPgraphic{whatever}{color=blue}]
939%
940% \starttext
941%     \startTEXpage
942%         \pushbutton [reset] [page(2)]
943%     \stopTEXpage
944%     \startTEXpage
945%         \pushbutton [reset] [page(1)]
946%     \stopTEXpage
947% \stoptext
948
949
950% \setupinteraction[state=start]
951%
952% \definepushbutton [reset]
953%
954% \startuniqueMPgraphic{whatever}{color}
955%     fill fullcircle xysized (OverlayWidth,OverlayHeight) withcolor \MPvar{color} ;
956% \stopuniqueMPgraphic
957%
958% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=red}]
959% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=green}]
960% \definepushsymbol [reset] [d] [\uniqueMPgraphic{whatever}{color=blue}]
961%
962% \starttext
963%     \startTEXpage
964%         \pushbutton [reset] [page(2)]
965%     \stopTEXpage
966%     \startTEXpage
967%         \pushbutton [reset] [page(1)]
968%     \stopTEXpage
969% \stoptext
970
971% \appendtoks
972%     \let\startrob\scrn_menu_rob_start
973%     \let\stoprob \relax
974%     \let\rob     \scrn_menu_rob_direct
975% \to \everysetmenucommands
976
977% \protect \endinput
978