[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Rendering html as tooltip
|
There isn't a way to pack the Browser to the size of its content, so you
need to specify a size for the Browser, otherwise it just defaults to 64x64.
You can make its scrollbars only appear if needed by setting the body.style
attribute to 'overflow:auto' as shown below:
String html = "<html><body style='overflow:auto;'><h1>Some javadoc
here</h1><p>and some more here</p></body></html>";
Grant
"Hongying Zhang" <hongying.zhang@xxxxxxx> wrote in message
news:47DA935D.9020109@xxxxxxxxxx
> Grant Gayed wrote:
> > Hi Michael,
> >
> > You'll need to implement fake tooltips and put Browser widgets within
them.
> > For examples of these see:
> >
> > fake tooltips:
> >
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java?rev=HEAD&content-type=text/vnd.viewcvs-markup
> > setting html content into a Browser:
> >
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java?rev=HEAD&content-type=text/vnd.viewcvs-markup
> >
> > Grant
> >
> > "Michael Bishop" <michael_bishop@xxxxxxxxxxxxxx> wrote in message
> > news:cp12ek$bqq$1@xxxxxxxxxxxxxxxxxx
> >> Hi,
> >>
> >> Using SWT, I want to render an HTML string as a tooltip.
> >>
> >> I have looked at the HoverHelp example that comes with Eclipse which I
> >> understand but I cannot find an SWT widget that renders HTML.
> >>
> >> Can anyone help ?
> >>
> >> Thankyou
> >>
> >> Michael Bishop
> >>
> >
> >
> 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
>
>