Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » adding SelectionListeners to MessageDialog Buttons
adding SelectionListeners to MessageDialog Buttons [message #436197] Wed, 12 May 2004 16:56 Go to next message
Eclipse UserFriend
Originally posted by: 50295.web.de

I've created an instance of the MessageDialog with the buttons "YES" and
"NO" i.e.;

MessageDialog dialog = new MessageDialog(getShell(), dialogTitle, null,
dialogMessage, MessageDialog.ERROR, new String[]{"Yes", "No"}, 1);
dialog.open();

As it is, these YES and No buttons do nothing. They simply close the
dialog. I would however like to have them behave differently. My current
attempt at doing so invloves subclassing MessageDialog and calling the
method getButton(int index) - which is supposed to return the button
with the specified index on the button bar. Stangely, I keep getting
null although the buttons YES and NO exist.

Is this the correct way to modify the default behaviour of the
MessageDialog buttons? Any hints anyone?

Thanks

- Olumide
Re: adding SelectionListeners to MessageDialog Buttons [message #436199 is a reply to message #436197] Wed, 12 May 2004 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 50295.web.de

> MessageDialog dialog = new MessageDialog(getShell(), dialogTitle, null,
> dialogMessage, MessageDialog.ERROR, new String[]{"Yes", "No"}, 1);
> dialog.open();

>
> Is this the correct way to modify the default behaviour of the
> MessageDialog buttons? Any hints anyone?

Silly me. I should have read a bit more code before posting this one.
All thats needed its to get the zero-indexed return code:

dialog.getReturnCode();
Re: adding SelectionListeners to MessageDialog Buttons [message #436562 is a reply to message #436197] Wed, 19 May 2004 13:28 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
You may get more response if you ask this on the eclipse.platform newsgroup
since that is where jface classes live.

Grant

"Olumide" <50295@web.de> wrote in message news:c7tkro$5d8$1@eclipse.org...
> I've created an instance of the MessageDialog with the buttons "YES" and
> "NO" i.e.;
>
> MessageDialog dialog = new MessageDialog(getShell(), dialogTitle, null,
> dialogMessage, MessageDialog.ERROR, new String[]{"Yes", "No"}, 1);
> dialog.open();
>
> As it is, these YES and No buttons do nothing. They simply close the
> dialog. I would however like to have them behave differently. My current
> attempt at doing so invloves subclassing MessageDialog and calling the
> method getButton(int index) - which is supposed to return the button
> with the specified index on the button bar. Stangely, I keep getting
> null although the buttons YES and NO exist.
>
> Is this the correct way to modify the default behaviour of the
> MessageDialog buttons? Any hints anyone?
>
> Thanks
>
> - Olumide
>
Previous Topic:OpenGL: avoiding array copies?
Next Topic:Eclipse 3.0: Browser Widget with Mozilla under Windows
Goto Forum:
  


Current Time: Thu Apr 25 03:50:10 GMT 2024

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

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

Back to the top