Autore Topic: Aiuto Tooltip utilizzando HTML  (Letto 339 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.724
  • Ne mors quidem nos iunget
    • Mostra profilo
Aiuto Tooltip utilizzando HTML
« il: 25 Gennaio 2014, 16:30:38 »
Riporto questa discussione apparsa nella M.L. ufficiale:


" I'm having a problem with the tooltips.  It works fine with regular
text but when I use HTML for a multi-line tooltip the results are not
predictable.  Most of the time an extra blank line shows up at the
bottom. Seems like it might be wrapping if the last line is shorter (yes
shorter).

   A code example looks like :

Codice: gambas [Seleziona]
Dim sHTML AS String

     sHTML &= "<html>"
     sHTML &= "<table cellpadding=1>"
     sHTML &= "<tr><td align=right>Note on</td><td align=left>G#/Ab</tr>"
     sHTML &= "<tr><td align=right>Row</td><td align=left>44</tr>"
     sHTML &= "<tr><td align=right>Velocity</td><td align=left>96</tr>"
     sHTML &= "</table>"
     sHTML &= "</html>"

     gvEvents.Tooltip = sHTML


It does not seem to matter if the "<html>" tag is included or not or
if the attribute values are enclosed in single or double quotes.
The table cells can have different colors or font sizes and works fine.  Just a
strange extra line at the bottom (not always).  Any idea?  I've tried
numerous simple HTML snippets that work fine and wonder if it is just the fact of the <table> inside.

   I've been developing a MIDI app using the ALSA API which works well
but I'm surprised there is not a wrapper already out there for Gambas,
anyone already written one?

   The opaque structures and macros for hiding the actual implementation
are a good design for C but not so nice for Gambas. I gave up on the
timing callback thinking the callback cannot occur properly since they
are on different threads. I have a separate player and a GUI that
communicate via pipes, works good.

  Thanks for Gambas!  I come home from a day of Java abstract
frameworks, inversion of control, more
and more bloat and just write stuff that is fun and actually works.

Sam



" HTML is not supported in tooltips at the moment.

It only partially works with gb.qt4 by chance, because of QT4 that has
automatic HTML detection that I can't disable.

Regards,

--
Benoît Minisini
"
« Ultima modifica: 25 Gennaio 2014, 17:44:54 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.724
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Aiuto Tooltip utilizzando HTML
« Risposta #1 il: 25 Gennaio 2014, 17:43:44 »
...continua...


" Hi Sam

It looks like you didn't close your second td of each row properly... I
guess try it first with valid html...

Codice: gambas [Seleziona]
Dim sHTML AS String

      sHTML &= "&lt;html>"
      sHTML &= "&lt;table cellpadding=1>"
      sHTML &= "&lt;tr>&lt;td align=right>Note on&lt;/td>&lt;td align=left>G#/Ab&lt;/td>&lt;/tr>"
      sHTML &= "&lt;tr>&lt;td align=right>Row&lt;/td>&lt;td align=left>44&lt;/td>&lt;/tr>"
      sHTML &= "&lt;tr>&lt;td align=right>Velocity&lt;/td>&lt;td align=left>96&lt;/td>&lt;/tr>"
      sHTML &= "&lt;/table>"
      sHTML &= "&lt;/html>"

      gvEvents.Tooltip = sHTML


I would also be in the habit of wrapping the alignment and padding
params in double-quotes, but perhaps that's getting too picky...and as
you say, it doesn't seem to make much difference...

Codice: gambas [Seleziona]
Dim sHTML As String

   sHTML &= "&lt;html>"
   sHTML &= "&lt;table cellpadding=\"1\">"
   sHTML &= "&lt;tr>&lt;td align=\"right\">Note on&lt;/td>&lt;tdalign=\"left\">G#/Ab&lt;/td>&lt;/tr>"
   sHTML &= "&lt;tr>&lt;td align=\"right\">Row&lt;/td>&lt;tdalign=\"left\">44&lt;/td>&lt;/tr>"
   sHTML &= "&lt;tr>&lt;td align=\"right\">Velocity&lt;/td>&lt;tdalign=\"left\">96&lt;/td>&lt;/tr>"
   sHTML &= "&lt;/table>"
   sHTML &= "&lt;/html>"
...


Another thing to watch for is that your data might cause some odd
effects if you have non-html-safe characters.

Kind regards,
Caveat
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.724
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Aiuto Tooltip utilizzando HTML
« Risposta #2 il: 25 Gennaio 2014, 18:26:13 »
Sull'uso del protocollo HTML con la prprietà ''.ToolTip'' nel nostro forum è stato più volte trattato....
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »