adding SelectionListeners to MessageDialog Buttons [message #436197] |
Wed, 12 May 2004 16:56 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Grant Gayed 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
>
|
|
|
Powered by
FUDForum. Page generated in 0.02767 seconds