Re: Message Dialog default focus button [message #330789] |
Wed, 13 August 2008 13:42 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Dhiresh wrote:
> Hi,
> I have problem setting focus on a particular button when using Message
> Dialog.
> Here is my code:
>
> String[] buttonText = new String[]{"&Ok", "&Cancel"};
>
> MessageDialog messageBox = new MessageDialog(this.getShell(), "Error",
> null, "Eorror Message", MessageDialog.ERROR, buttonText,1);
>
> When I open the dialog, OK button has the focus instead of Cancel button;
>
> How do I set focus to the cancel button?
Note: this is actually a JFace question (not SWT) so I've copied the
eclipse.platform newsgroup where JFace questions are more appropriate.
If I run the following (in Eclipse 3.3 and 3.4), the Cancel button has
focus:
public static void main(String[] args) {
String[] buttonText = new String[]{"&Ok", "&Cancel"};
new MessageDialog(
new Shell(),
"Error",
null,
"Eorror Message",
MessageDialog.ERROR,
buttonText,
1).open();
}
|
|
|
Powered by
FUDForum. Page generated in 0.02564 seconds