|
Re: Tooltips for disabled Buttons [message #734399 is a reply to message #733652] |
Fri, 07 October 2011 15:40 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Thomas,
(verified on win32) The following snippet demonstrates getting a
MouseHover event. From this you should be able to show a custom tooltip
(either a ToolTip instance or an emulated tooltip like in
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java
).
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,200,200);
Composite composite = new Composite(shell, SWT.NONE);
composite.setBounds(10,10,90,50);
Button button = new Button(composite, SWT.PUSH);
button.setBounds(0,0,90,50);
button.setText("button");
composite.addListener(SWT.MouseHover, new Listener() {
public void handleEvent(Event event) {
System.out.println("called");
// show a custom tooltip here
}
});
button.setEnabled(false);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
On 10/5/2011 6:04 AM, T. Wilhelm wrote:
> Hi all,
>
> i want to show a tooltip for a disabled button (because i want to
> display why it´s disabled), is there any solution? I already searched in
> this forum, but the answer was that it is the expected behaviour on
> windows that disabled buttons cannot show tooltips :( Does anyone have a
> good workaround?
>
> Thanks alot
> Thomas
|
|
|
|
Powered by
FUDForum. Page generated in 0.02011 seconds