ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Zhichu Chen" <zhichu.chen@gmail.com>
Subject: How to display JavaScript's values in ConTeXt
Date: Tue, 5 Sep 2006 12:56:24 +0800	[thread overview]
Message-ID: <769ba7780609042156u73f92c2etf317b250759ab1d8@mail.gmail.com> (raw)

Hello everybody,

    I want to add a clock which shows the system time to a pdf file.
And I have read the ``art-calc.pdf'' and ``mwidget-p.pdf'' to find
some approaches but failed shamely. I am indeed new at ConTeXt and
JavaScript. Before I'm shocked by ConTeXt, I used LaTeX for about 2
years, so I'm confused with the conventions between ConTeXt and LaTeX.
My code is here:

----------------------------------------------------------------------------------
\setupinteraction[state=start]

\startJSpreamble functions used now
  function do_digit(d)
    { Stack[Level] += String(d);
      do_refresh(Level) }
\stopJSpreamble

\startJScode{digit}
  do_digit(JS_S_1);
\stopJScode

\definefield[Stack.1][line][Results][][

\setupfield
  [Results]
  [horizontal,frame]
  [width=fit,
   height=2cm,
   frame=on]
  [height=18pt,width=80pt,align=middle,frame=off]
  [height=18pt,width=80pt,color=red,align=right,style=type,frame=off]

\setupbuttons [background=infobutton]

\starttext

Click \button{7}[JS(digit{7})] will get
\field[Stack.1]

\stoptext
--------------------------------------------------------------------------------

I only copied these codes from "art-calc.pdf" so there must be some
other critical concepts that I haven't realized. Please point them to
me. Thanks

             reply	other threads:[~2006-09-05  4:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05  4:56 Zhichu Chen [this message]
2006-09-05  9:42 ` Peter Rolf
2006-09-06  2:01 Zhichu Chen
2006-09-06 10:06 ` Peter Rolf
2006-09-06  2:02 Zhichu Chen
2006-09-07  0:49 Zhichu Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=769ba7780609042156u73f92c2etf317b250759ab1d8@mail.gmail.com \
    --to=zhichu.chen@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).