ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <gip.bilotta@iol.it>
Cc: ntg-context@ntg.nl
Subject: Re[2]: [NTG-context] tooltips
Date: Mon, 21 Oct 2002 17:56:01 +0200	[thread overview]
Message-ID: <17835324293.20021021175601@iol.it> (raw)
In-Reply-To: <20021021142630.32689d53.morawski@gmx.net>


Monday, October 21, 2002 Jens-Uwe Morawski wrote:

JUM> On Sun, 20 Oct 2002 23:59:31 +0200
JUM> Hans Hagen <pragma@wxs.nl> wrote:

>> i come back to the tooltips later

JUM> before i forget it, i would like to give here an additional idea
JUM> about this topic:

JUM> IMO, the whole thing should be more general, maybe by calling it
JUM> 'balloons' or 'balloonwidget'. The usage in \footnote, \tooltip or
JUM> \cite is only an instance of the more general balloon-object.

JUM> For example, i would like to use such a ballon-widget as a
JUM> dropdown-menu in an interactive document that contains
JUM> a list of chapters, ...:

JUM> \balloon[placement={below,centered},
JUM>         frameclass=DropMenu,
JUM>         opendirection=down,
JUM>         openaction=OnClick]
JUM>         {Chapters}
JUM>         {\placelist
JUM>             [chapter]
JUM>             [criterium=all,
JUM>              alternative=a,
JUM>              pagenumber=no,
JUM>              interaction=all]}

JUM> and tooltips are then:
JUM> \defineballoon[tooltip][...]

I have a draft implementation for this.

By now, the only thing
that can be configured is the framecommand. I decided to use this
instead of a frameclass because it's even more flexible
(with frameclass, you need to define a different frame class for each
different ballon type, even if changes are small; this way, small
changes can be applied more easily when defining new tooltips.)

Put the following code in your cont-new.tex file or in your
cont-loc.tex file (whichever you use for customizations), until
Hnas decides to pass it to the core. I hope to come out myself
with more customization options, but I would have to study fields
and co. Maybe I'll leave that to Hans though.

BTW, your stuff seems to more oriented towards what Hans called
"helps" rather than tooltips, but I don't know much about this
feature.

Anyway, here's the code for custom balloons. Hope I didn't
reinvent the wheel ...

===== BEGIN CODE =====
% Redefine tooltips as a subclass of the more generic balloon
% class

\startconstants              all
               framecommand: framecommand
\stopconstants


\def\defineballoon[#1][#2]{%
  \@EA\def\csname#1\endcsname
    {\dodoubleempty\doballoon[#1]}%
  \@EA\def\csname\e!stel#1\e!in\endcsname
    {\dodoubleempty\setupballon[#1]}%
  \setupballoon[#1][#2]}

% Currently only supports framecommand
\def\setupballoon[#1][#2]{%
  \getparameters[balloon:#1:][#2]
}


\def\doballoon[#1][#2]#3#4%
  {\bgroup
   \setupfields[\v!reset]%
   \useJSscripts[fld]%
   \setbox0\hbox
     {\mindermeldingen
      \nextsystemfield
      \trialtypesettingtrue
        \setbox0=\hbox{#3}%
      \trialtypesettingfalse
      \definesymbol
        [\currentsystemfield:txt]
        [{\getvalue{balloon:#1:\c!framecommand}{#4}}]%
      \trialtypesettingtrue
        \setbox2=\hbox{\symbol[\currentsystemfield:txt]}%
      \trialtypesettingfalse
      \definefield
        [\currentsystemfield:txt][check]
        [dummy][\currentsystemfield:txt][\currentsystemfield:txt]%
      \setupfield
        [dummy]
        [\c!kader=\v!uit,
         \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt}),
         \c!optie=\v!verborgen]%
      \hbox to \zeropoint
         {\dimen0\wd2\advance\dimen0 -\wd0
          \doifelse{#2}\v!links
            {\hskip-\dimen0}
            {\doif{#2}\v!midden
               {\hskip-.5\dimen0}}%
          \lower\openlineheight % this needs to be configurable
          \hbox to \zeropoint
            {\fitfield[\currentsystemfield:txt]}}%
      \dimen0=\ifdim\wd0=\zeropoint 3em\else\wd0\fi
      % Should the following be configurable too?
      \definesymbol
        [\currentsystemfield:but]
        [{\framed[\c!hoogte=2ex,\c!breedte=\dimen0,\c!kader=\v!uit]{}}]%
      \definefield
        [\currentsystemfield:but][push]
        [dummy][\currentsystemfield:but][\currentsystemfield:but]%
      \setupfield
        [dummy]
        [\c!kader=\v!uit,
         \c!optie=,
         \c!gebiedin=JS(Vide_Field{\currentsystemfield:txt}),
         \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt})]%
       \lower2ex % this should be configurable
       \hbox to \zeropoint
         {\fitfield[\currentsystemfield:but]}%
      #3}%
  \ht0=\ht\strutbox\dp0=\dp\strutbox\box0
  \egroup}

% Redefines the old tooltip with the new command ...

\defineballoon[tooltip][\c!framecommand={\inframed[\c!kader=\v!uit,\c!achtergrond=\v!raster]}]

===== END CODE =====

-- 
Giuseppe "Oblomov" Bilotta

_______________________________________________
ntg-context mailing list
ntg-context@ref.ntg.nl
http://ref.ntg.nl/mailman/listinfo/ntg-context


  parent reply	other threads:[~2002-10-21 15:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-20 21:59 Hans Hagen
2002-10-21 12:26 ` Jens-Uwe Morawski
2002-10-21 13:45   ` Re[2]: " Giuseppe Bilotta
2002-10-21 15:56   ` Giuseppe Bilotta [this message]
2002-10-21 20:45     ` Jens-Uwe Morawski
  -- strict thread matches above, loose matches on Subject: below --
2002-10-17 17:01 [NTG-context] Tooltips Giuseppe Bilotta
2002-10-17 23:41 ` Jens-Uwe Morawski
2002-10-18 13:01   ` Re[2]: " Giuseppe Bilotta
2002-10-18 18:54     ` Henning Hraban Ramm

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=17835324293.20021021175601@iol.it \
    --to=gip.bilotta@iol.it \
    --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).