summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/popupmenu/examples/pumen_ex.tex
blob: 6f0acc7a5f1f18644a403d28b1cf77b06fbea7a5 (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
99
100
101
102
103
104
105
106
107
108
\documentclass{article}
\usepackage[designv]{web}
\usepackage{eforms}
\usepackage{popupmenu}

\title{The \texorpdfstring{\textsf{popupmenu}}{popupmenu} Package Test File}
\author{D. P. Story}
\subject{Test file for the popupmenu Package}
\keywords{LaTeX, popupmenu, Acrobat JavaScript, AcroTeX}

\university{NORTHWEST FLORIDA STATE COLLEGE\\
   Department of Mathematics}
\email{dpstory@acrotex.net}
\version{1.0}

%\nocopyright
\norevisionLabel

%
% This package can be used by users of pdftex, dvipdfm, dvips (with distiller)
%

\urlPath{\aebhome}{http://www.math.uakron.edu/~dpstory}

\begin{popupmenu}{AeBMenu}
    \item{title=AeB, return=\aebhome/webeq.html}
    \item{title=-}
    \begin{submenu}{title=AeB Pro Family}
        \item{title=Home page,return=\aebhome/aeb_pro.html}
        \item{title=Graphicxsp,return=\aebhome/graphicxsp.html}
    \end{submenu}
    \item{title=eqExam,return=\aebhome/eqexam.html}
\end{popupmenu}

\begin{popupmenu}{AeBMenuLocal}
    \item{title=AeB, return=\aebhome/webeq.html}
    \item{title=-}
    \begin{submenu}{title=AeB Pro Family,enabled=false}
        \item{title=Home page,return=\aebhome/aeb_pro.html}
        \item{title=Graphicxsp,return=\aebhome/graphicxsp.html}
    \end{submenu}
    \item{title=eqExam,return=\aebhome/eqexam.html}
\end{popupmenu}

%
% This menu was taken from the Acrobat JavaScript API Reference
% as a test of the new popupmenu and submenu environments.
%
\begin{popupmenu}{myMenu}
    \item{title=Item 1, marked, enabled=false}
    \item{title=-}
    \begin{submenu}{title=Item 2}
        \item{title={Item 2, Submenu 1}}
        \begin{submenu}{title={Item 2, Submenu 2}}
            \item{title={Item 2, Submenu 2, Subsubmenu 1}}
        \end{submenu}
    \end{submenu}
    \item{title=Item 3}
    \item{title=Item 4}
\end{popupmenu}

\begin{insDLJS}[AeBMenu]{md}{Menu Data}
\AeBMenu
\myMenu
\end{insDLJS}

\parindent0pt\parskip6pt

\begin{document}

\maketitle

This file uses the \textsf{eforms} package to create push buttons,
the push button of \textsf{hyperref} can also be used.

Here is an example taken from the Acrobat JavaScript API Reference:
\pushButton[\CA{My Menu}\AA{\AAMouseEnter{\JS{%
var cChoice = \popUpMenu(myMenu);\r
if ( cChoice != null ) app.alert("You chose the \\""+cChoice+"\\" menu item");
}}}]{mymenu}{}{11bp}

We can add a push button with a rollover effect
\pushButton[\CA{Packages}\AA{\AAMouseEnter{\JS{%
var cChoice = \popUpMenu(AeBMenu);\r
if ( cChoice != null ) app.launchURL(cChoice);
}}}]{menu}{}{11bp}

You can also open the menu with a link:
\setLinkText[\A{\JS{%
var cChoice = \popUpMenu(AeBMenu);\r
if ( cChoice != null ) app.launchURL(cChoice);
}}]{Package}. Links do not have a rollover effect, however, you can use buttons like so: {\setbox0=\hbox{\textcolor{red}{Packages}}%
\makebox[0pt][l]{\pushButton[\W0\BG{}\BC{}\S{S}\AA{\AAMouseEnter{\JS{%
var cChoice = \popUpMenu(AeBMenu);\r if ( cChoice != null )
app.launchURL(cChoice); }}}]{menu}{\wd0}{\ht0+\dp0}}\unhbox0}.

This is a version that has a local version of the menu array:
{\setbox0=\hbox{\textcolor{red}{Packages}}%
\makebox[0pt][l]{\pushButton[\W0\BG{}\BC{}\S{S}\AA{\AAMouseEnter{\JS{%
\AeBMenuLocal\r
var cChoice = \popUpMenu(AeBMenuLocal);\r if ( cChoice != null )
app.launchURL(cChoice);}}}]{menu}{\wd0}{\ht0+\dp0}}\unhbox0}
\end{document}

This is a version that has a local version of the menu array:
\PushButton[name=hyperbutton,onmouseover={\AeBMenuLocal
var cChoice = \popUpMenu(AeBMenuLocal); if ( cChoice != null )
app.launchURL(cChoice); }]{Packages}