summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/interaction/interaction-buttons.tex
blob: 1a8e698cf8ca3dcc40b5df632d74e32a6bbf382f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
\environment interaction-style

\startcomponent interaction-buttons

\startchapter[title={Buttons}]

There is not much to tell about buttons. They are clickable areas on the screen
that when clicked on bring you some location or invoke some action in the viewer,
for instance triggered by a \JAVASCRIPT. As usual with many commands, you can
define categories of buttons and set them up globally or per category.

\showsetup{definebutton}

\showsetup{setupbutton}

The default button command is:

\showsetup{button}

Buttons are an example of a construct that builds upon \type {\framed} so the
keys that apply there also apply to buttons. You can enable or disable buttons
with the \type {state} parameter. As usual there are a \type {style} and \type
{color} parameters and an additional \type {contrastcolor} option for tuning the
color of a button which action let you stay on the same page. Actually, when you
do stay on the same page, the \type {samepage} parameter let you control if the
button should be empty, hidden or whatever.

\starttabulate[|B|c|c|c|]
\NC                 \BC frame \BC text \BC shown \NC \NR
\NC \type {yes}     \NC +     \NC +    \NC +     \NC \NR % 0
\NC \type {empty}   \NC +     \NC -    \NC +     \NC \NR % 1
\NC \type {no}      \NC -     \NC -    \NC +     \NC \NR % 2
\NC \type {none}    \NC -     \NC -    \NC -     \NC \NR % 3
\NC \type {normal}  \NC +     \NC +    \NC +     \NC \NR % 1
\NC \type {default} \NC +     \NC +    \NC +     \NC \NR % 1
\stoptabulate

Here is an example of a button:

\startbuffer
\button
  [background=color,backgroundcolor=darkred,
   style=bold,color=white,
   framecolor=blue,rulethickness=2pt,
   width=3cm,height=1.5cm]
  {go to the next page}
  [nexpage]
\stopbuffer

\typebuffer

This colorful button shows up as:

\startlinecorrection
\getbuffer
\stoplinecorrection

When you use interaction in presentations you might want to make the page
and|/|or text area active. Here is an example.

\starttyping
\defineoverlay
  [PrevPage]
  [\overlaybutton{PrevPage}]

\setupbackgrounds
  [page]
  [background=PrevPage]

\setuptexttexts
  [\overlaybutton{NextPage}]
\stoptyping

We provide two variants: the normal one with square brackets, but also a more
direct one that accepts curly braces, which is handy when you pass an overlay
button as argument.

\showsetup {overlaybutton}
\showsetup {overlaybutton:direct}

The difference in usage is shown here:

\starttyping
\setuptexttexts [\overlaybutton{NextPage}]
\setuptexttexts[{\overlaybutton[NextPage]}]
\stoptyping

An overlay button adapts its size to the current overlay so you don't need to
worry about passing dimensions.

It is possible to define more complex buttons, like roll|-|over buttons or
buttons that change appearance when you click on them. These are more resource
hungry and also depend on the viewer. These will discussed in the chapter about
widgets.

\stopchapter

\stopcomponent