Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Message Dialog default focus button
Re: Message Dialog default focus button [message #330789] Wed, 13 August 2008 13:42
Eclipse UserFriend
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();
}
Previous Topic:Tale of two display
Next Topic:Best way of removing data from a virtual TableViewer
Goto Forum:
  


Current Time: Sat Dec 21 11:35:50 GMT 2024

Powered by FUDForum. Page generated in 0.02689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top