One question about Tips. [message #459384] |
Mon, 08 August 2005 11:25  |
Eclipse User |
|
|
|
Originally posted by: qingxing20052.gmail.com
Dear all:
I have one quesiton:
If I want to keep the tool tip showing as long as the cursor is in the
component, can I do it in SWT?
In Swing, it is easy to do it:
Set ToolTipManager the Max number value.
But SWT doesn't support such method.
How to solve this problem?
I am looking forward to hearing from you.
Thx for any suggestion and help!
Have a nice day,
B.W
|
|
|
|
Re: One question about Tips. [message #459391 is a reply to message #459387] |
Mon, 08 August 2005 13:25  |
Eclipse User |
|
|
|
another snippet that demonstrates a fake tooltip:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet125.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
"Max Rotvel" <this.address@is.invalid> wrote in message
news:op.su66j2v8nl651a@trixie.katlan...
> On Mon, 08 Aug 2005 17:25:36 +0200, eclipse.newcomer
> <qingxing20052@gmail.com> wrote:
>
> > If I want to keep the tool tip showing as long as the cursor is in the
> > component, can I do it in SWT?
>
> You can't, probably because the operating system is drawing the tooltips.
>
> > How to solve this problem?
>
> You need to draw your own tooltip. Have a look at the sourcecode for
>
org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInfo rmationControl.j
ava
>
> I wrote one that is draggable and disappears when it looses focus. Here's
> the code that draws my tooltip shell:
>
> private void show(final Control control, String txt)
> {
> final Shell shell = new Shell(control.getShell(), SWT.NO_TRIM);
> final Display display = shell.getDisplay();
>
> FillLayout layout = new FillLayout();
> layout.marginWidth = layout.marginHeight = 1;
> shell.setLayout(layout);
> shell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)) ;
>
> Composite compo = new Composite(shell, SWT.NONE);
> compo.setBackground(display.getSystemColor(SWT.COLOR_INFO_BA CKGROUND));
> FillLayout layout2 = new FillLayout();
> layout2.marginWidth = layout2.marginHeight = 2;
> compo.setLayout(layout2);
>
> Label label = new Label(compo, SWT.NONE);
> label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FO REGROUND));
> label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BA CKGROUND));
> label.setText(txt);
>
> --
> Max - rotvel AT bolignet-aarhus DOT dk
|
|
|
Powered by
FUDForum. Page generated in 0.28252 seconds