https://wiki.contextgarden.net/api.php?action=feedcontributions&user=77.45.154.243&feedformat=atom
Wiki - User contributions [en]
2024-03-29T02:00:12Z
User contributions
MediaWiki 1.34.1
https://wiki.contextgarden.net/index.php?title=Widgets&diff=8647
Widgets
2008-06-07T18:24:03Z
<p>77.45.154.243: </p>
<hr />
<div>< [[Visuals]] | [[Interaction]] ><br />
<br />
You find more about interactive elements in [http://www.pragma-ade.com/general/manuals/mwidget-s.pdf Widgets uncovered] and [http://source.contextgarden.net/core-fld.tex core-fld.tex].<br />
<br />
At the moment all of the following examples are from <tt>mwidget</tt> manual. We will cook up our own later.<br />
<br />
For PDF is only an interface, you need JavaScript to handle interaction (field input etc.).<br />
<br />
=JavaScript=<br />
<br />
<texcode><br />
\startJSpreamble {name}<br />
MyCounter = 0 ;<br />
\stopJSpreamble<br />
<br />
\startJScode {increment}<br />
MyCounter = MyCounter + 1 ; // or: ++MyCounter ;<br />
\stopJScode<br />
<br />
\goto {advance by one} [JS(increment)]<br />
</texcode><br />
<br />
You can pass values to a JS function:<br />
<br />
<texcode><br />
\startJScode {increment}<br />
MyCounter = MyCounter + JS_V_1 ;<br />
\stopJScode<br />
<br />
\goto {advance by five} [JS(increment{V{5}})]<br />
</texcode><br />
<br />
* V{} is verbose, defaults to string<br />
* S{} = as string<br />
* R{} = as reference<br />
* JS_V_n, JS_S_n, JS_R_n are the names of the variables<br />
* JS_N keeps the number of arguments<br />
<br />
=Fields=<br />
<br />
{{Explanation}}<br />
<br />
==Text Entries==<br />
<br />
see<br />
* <cmd>setupfield</cmd>, <cmd>setupfields</cmd><br />
* <cmd>definefield</cmd><br />
* <cmd>field</cmd><br />
* <cmd>fillinfield</cmd><br />
* <cmd>fillinlines</cmd><br />
* <cmd>fillintext</cmd><br />
* <cmd>fillinrules</cmd><br />
<br />
<texcode><br />
\fillinfield[name]{text that defines field length}<br />
% or<br />
\definefield [Email] [line] [ShortLine] [] [sample@contextgarden.net]<br />
\field [Email] [your email]<br />
</texcode><br />
<br />
<cmd>definefield</cmd><tt>[name][type][setup name][?don't know?][default content]</tt><br />
<br />
<cmd>field</cmd><tt>[name][?don't know?]</tt><br />
<br />
==Radiobuttons==<br />
<br />
Sample from the manual:<br />
<br />
<texcode><br />
\setupfield [LogoSetup]<br />
[width=4cm,<br />
height=4cm,<br />
frame=off,<br />
background=screen]<br />
<br />
\definefield[Logos] [radio] [LogoSetup]<br />
[ConTeXt,PPCHTEX,TeXUtil] [PPCHTEX]<br />
<br />
\definesubfield [ConTeXt] [] [ConTeXtLogo]<br />
\definesubfield [PPCHTEX] [] [PPCHTEXLogo]<br />
\definesubfield [TeXUtil] [] [TeXUtilLogo]<br />
<br />
\definesymbol [ConTeXtLogo] [{\externalfigure[mpcont.502]}]<br />
\definesymbol [PPCHTEXLogo] [{\externalfigure[mpcont.503]}]<br />
\definesymbol [TeXUtilLogo] [{\externalfigure[mpcont.504]}]<br />
<br />
\hbox to \hsize{\hss\field[ConTeXt]\hss\field[PPCHTEX]\hss\field[TeXUtil]\hss}<br />
</texcode><br />
<br />
==Checkboxes==<br />
<br />
<texcode><br />
\setupfield[setup 3]<br />
[width=2cm, height=2cm,<br />
rulethickness=3pt, corner=round, framecolor=red]<br />
<br />
\definesymbol [yes] [{\externalfigure[mpcont.502]}]<br />
\definesymbol [no] []<br />
\definefield [checkme][check] [setup 3] [yes,no] [no]<br />
\field[checkme]<br />
</texcode><br />
<br />
=Tricks=<br />
<br />
This helps debugging:<br />
<br />
<texcode><br />
\tracefieldstrue<br />
\showfields % typeset a table of field relations<br />
\logfields % logs field descriptions to a file fields.log<br />
</texcode></div>
77.45.154.243