ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* My ideas for tooltips
@ 2001-02-14 21:34 Giuseppe Bilotta
  2001-02-15  8:13 ` Taco Hoekwater
  0 siblings, 1 reply; 18+ messages in thread
From: Giuseppe Bilotta @ 2001-02-14 21:34 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

The attached file presents my latest ideas on tooltips,
with some tests (in Italian, but even if you don't
understand what's written, it doesn't matter). The only
point is: displayed formulas don't work. Any ideas on why?
(the relative text is commented out).

Giuseppe Bilotta

Using Microsoft products is like 
having sex without condoms---but
much less pleasurable

[-- Attachment #2: gb-tips.tex --]
[-- Type: application/octet-stream, Size: 4036 bytes --]

\unprotect

\def\gbtooltip%
  {\dosingleempty\dogbtooltip}
\newdimen\gbarea
\newdimen\gbwidth
\newcount\gbtrunc
\newcount\gbintarea

\long\def\dogbtooltip[#1]#2#3%
  {\bgroup 
   \setupfields[\v!reset]%
   \useJSscripts[fld]%
   \setbox0=\hbox
     {\mindermeldingen
      \nextsystemfield
      \setbox0=\hbox{#2}%
      \setbox2\hbox{#3}%
      \gbarea\ht2\advance\gbarea by\dp2%
      \dimensiontocount{\gbarea}{\gbintarea}%
      \dimensiontocount{\wd2}{\gbtrunc}%
      \multiply\gbintarea by\gbtrunc%
      \divide\gbintarea by2% l= \sqrt{\frac{A}{2}}
      \findlines%
      \definesymbol
        [\currentsystemfield:txt]
        [{\framed[\c!kader=\v!uit,\c!achtergrond=\v!raster]%
        {\hbox{\vbox{\hsize\gbwidth\relax#3}}}}]%
      \setbox2=\hbox{\symbol[\currentsystemfield:txt]}%
      \definefield
        [\currentsystemfield:txt][check]
        [dummy][\currentsystemfield:txt][\currentsystemfield:txt]%
      \setupfield
        [dummy]
        [\c!kader=\v!uit,\c!optie=\v!verborgen]%
      \hbox to \!!zeropoint
         {\dimen0=\wd2\advance\dimen0 by -\wd0
          \doifelse{#1}{\v!links}
            {\hskip-\dimen0}
            {\doif{#1}{\v!midden}
               {\hskip-.5\dimen0}}%
          \dimen0\ht2\advance\dimen0by\dp2%
          \advance\dimen0by.5\openlineheight
          \lower\dimen0\hbox to \!!zeropoint
            {\fitfield[\currentsystemfield:txt]}}%
      \dimen0=\ifdim\wd0=\!!zeropoint 3em\else\wd0\fi
      \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})]%
       \lower\ht0\hbox to \!!zeropoint
         {\fitfield[\currentsystemfield:but]}%
      #2}%
  \ht0=\ht\strutbox\dp0=\dp\strutbox\box0
  \egroup}

\newcount\gblines
\newcount\gbtemparea
\def\findlines{% Find the number of lines that better fit the area
    \gblines0\relax%
    \loop\advance\gblines1%
    \dimensiontocount{\strutheight}{\gbtemparea}%
    \multiply\gbtemparea\gblines%
    \multiply\gbtemparea\gbtemparea%
    \ifnum\gbtemparea<\gbintarea\repeat%
    \gbwidth\strutheight\multiply\gbwidth by\gblines%
    \multiply\gbwidth by2\relax%
    }
\protect

\setupinteraction[state=start,openaction=ResetForm]

\useencoding[windows]
\starttext

%\tracingmacros=2
Ecco del testo con un mio \gbtooltip[middle]{tooltip}{Questo tooltip dovrebbe avere
un rettangolo con dimensioni circa in rapporto due ad uno}; facciamo
\gbtooltip{ancora una prova}{\switchtobodyfont[small]
Stavolta con qualcosa di molto più lungo; e perché no, mettiamoci
anche una formula, $x^2+y^2=r^2$, tanto per vedere come si comporta il
\TeX\ in queste situazioni~\dots\ sembra che si comporti molto bene;
allunghiamo ancora per essere sicuri che il rapporto 2:1 (in effetti minore)
vada bene anche per testi molto lunghi. Sembra non dare nessun fastidio~\dots\
e se lo definissimo \tex{long} ed usassimo un \tex{par} in mezzo, come sarebbe?
Non possiamo perché \CONTEXT\ definisce \tex{definesymbol} come non-\tex{long}.
Hm. Comunque, questo testo è posizionato vicino al bordo della pagina; sembra
che AcroRead non se ne curi, e sposti la finestra per farla rientrare nell'area
visibile; ora faremo qualche esperimento a zoom diversi per esserne sicuri.
No, pare di no. Se è troppo grosso va fuori. Bene.}; infine ne facciamo un'altra,
perché voglio togliermi una \gbtooltip[right]{curiosità}{La curiosità consiste
nel sapere come si comporta il mio algoritmo in presenza di cose tipo
%\placeformula\startformula
%\sin^2 \alpha + \cos^2\alpha = 1,
%\stopformula
ovvero la cosiddetta {\en displayed math}}.
%\tracingmacros=0
\stoptext

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

end of thread, other threads:[~2001-03-12  8:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 21:34 My ideas for tooltips Giuseppe Bilotta
2001-02-15  8:13 ` Taco Hoekwater
2001-02-16 10:45   ` Giuseppe Bilotta
2001-02-16 12:21     ` Taco Hoekwater
2001-02-16 21:45       ` Uwe Koloska
2001-02-17 17:25         ` Taco Hoekwater
     [not found]           ` <000501c0992c$f7eeb180$a3ccfea9@nuovo>
2001-02-17 23:28             ` Number conversions (Was Re: My ideas for tooltips) Taco Hoekwater
2001-02-19 11:18               ` Hans Hagen
2001-02-19 12:38                 ` Taco Hoekwater
2001-02-19 14:45                   ` Hans Hagen
2001-02-19 10:39         ` My ideas for tooltips Hans Hagen
2001-02-16 12:38     ` Hans Hagen
2001-02-16 18:57       ` Giuseppe Bilotta
2001-02-19 11:25         ` Hans Hagen
2001-02-19 22:48           ` Giuseppe Bilotta
2001-02-20 11:35             ` Hans Hagen
2001-02-20 22:49               ` Giuseppe Bilotta
2001-03-12  8:16                 ` Hans Hagen

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).