ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Toggle fields
@ 2003-05-12 10:27 Sytse Knypstra
  2003-05-12 11:41 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Sytse Knypstra @ 2003-05-12 10:27 UTC (permalink / raw)


Dear ConTeXt users,

In experimenting with (JavaScript) fields I tried the example on p. 11
in the up-to-date 1998/1 publication.

I placed the check field not in the margin, but in the running text and 
discovered
that \goto{Help}[JS(Toggle_Hide{Help})] does work if it is placed after 
\fitfield[Help],
but that it does not work if it is placed before \fitfield[Help].

For the commands \goto{Hide Help}[HideField{Help}] and \goto{Show 
Help}[ShowField{Help}]
their position relative to \fitfield[Help] does not matter.

Would it be possible to make a command ToggleField, analagous to HideField 
and ShowField,
whose position relative to \fitfield[Help} is not important?

Thank you,

Sytse

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Here is the complete example:

\setupoutput[pdftex]
\setupinteraction[state=start]

\starttext
\definefield[Help][check][Helpsetup][helpinfo][helpinfo]
\setupfields[reset]
\setupfield[Helpsetup][width=fit,height=fit,frame=off,option={readonly,hidden}]
\definesymbol[helpinfo][\SomeHelpText]
\def\SomeHelpText%
   {\framed
     [width=\leftmarginwidth,height=fit,align=middle,style=small,
      frame=on,background=color,backgroundcolor=white,framecolor=red]
     {Click on the hide button to remove this screen}}

%\fitfield[Help]  %  if uncommented, all three \goto's work ok
Now we can put the button somewhere and turn the help on or off by saying
\goto{Hide Help}[HideField{Help}] or \goto{Show Help}[ShowField{Help}].
Although it's better to put these commands in a dedicated part of the screen.
And try \goto{Help}[JS(Toggle_Hide{Help})].

\fitfield[Help]  % \goto{Help}[JS(Toggle_Hide{Help})] does not work

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-13  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12 10:27 Toggle fields Sytse Knypstra
2003-05-12 11:41 ` Hans Hagen
2003-05-13  8:07   ` Sytse Knypstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).