[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: HTML Tooltips?
|
Hi Grant,
I followed your instructions and the samples you mentioned above to set
a tooltip into a browser. However, my browser came out is very small
with both horizontal and vertical scroll bars.
Here is the code I setup browser:
Browser browser ;
Shell shell = new Shell (item.getShell(), SWT.ON_TOP | SWT.NO_FOCUS
| SWT.TOOL);
FillLayout layout = new FillLayout ();
shell.setLayout (layout);
try
{
browser = new Browser( shell, SWT.NONE );
}
catch(SWTError err)
{
System.out.println(err.getMessage);
}
browser.setText( htmltext );
Point size = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT);
Point pt = item.toDisplay (event.x, event.y);
shell.setBounds (pt.x, pt.y, size.x, size.y);
shell.setVisible (true);
If I use shell.getSize() to replace shell.computeSize( SWT.DEFAULT,
SWT.DEFAULT), that will make the tooltip came up too big. Can you please
give me some hint of how I can make my browser to the right size that
can hold the tooltip?
Thanks a lot!
Hongying Zhang
Grant Gayed wrote:
Putting a Browser in a fake tooltip is not such a big deal. Eclipse's
tooltips in (at least) JDT do this by creating an instance up-front and
hiding/showing it whenever needed.
Grant
"Stuart Pond" <Stuart.Pond@xxxxxxx> wrote in message
news:fr75fu$o04$1@xxxxxxxxxxxxxxxxxxxx
Thank you for the suggestion to use StyleText, but that will not work for
us. We are placing some existing Swing based controls that have HTML
tooltips already defined with SWT controls.
"Carolyn MacLeod" <Carolyn_MacLeod@xxxxxxxxxx> wrote in message
news:fr6e8j$k4t$1@xxxxxxxxxxxxxxxxxxxx
Note that StyledText won't do HTML (not sure if that was clear in Tom's
answer <g>), however you can use it to display text that is formatted
with
color and font changes, underlines, etc.
Carolyn
"Tom Schindl" <tom.schindl@xxxxxxxxxxxxxxx> wrote in message
news:fr6d40$i1$1@xxxxxxxxxxxxxxxxxxxx
The question is how much of HTML-Subset you need. You could also open a
StyledText-Widget in the custom tooltip or a Canvas where you draw
everything yourself. Fake tooltips are part of JFace 3.3.
Tom
Stuart Pond schrieb:
Swing has the capability to display HTML tooltips. How do I accomplish
this in SWT?
I know SWT tooltips are native and there might not support HTML. So I
would have to create fake tooltips. I found one suggestion to put a
browser control into a fake tooltip. That seems extremely heavy
handed
and resource intensive to do that. Is there any other alternative to
get marked up Tooltips?
--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl JFace-Committer
--------------------------------------------------------------------