3

I have a message dialog as follows:

import org.eclipse.jface.dialogs.MessageDialog


public void openQuestion(Shell parentShell, String title, String question, final int iconStyle){
MessageDialog dialog = new MessageDialog(
                    parentShell,
                    title,
                    getTitleIcon(iconStyle),
                    question,
                    iconStyle,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL },
                    0
                    ) {
                        @Override
                        public Image getImage() {
                            return getIcon(iconStyle);
                        }
            };

return dialog.open() == IDialogConstants.OK_ID;
    }

Here when I pass question(parameter) as a small string, I'm able to see OK, Cancel buttons in the dialog. But on the other hand, when I pass question(parameter) as a large string in the message dialog, OK and Cancel buttons are not visible in the dialog. They get hidden. Is there any way that the OK and Cancel buttons be displayed always??

Tharif
  • 13,794
  • 9
  • 55
  • 77
Sri
  • 669
  • 2
  • 13
  • 25
  • What is a 'large amount' for the question? Are you making the dialog to wide for the screen? – greg-449 Jun 26 '15 at 07:02
  • means - for example: "The books are used in places: "A" "B" "C" .etc,.., Do you want to continue?yes or no? so "A","B","C" vertically keep added..So diag size is increasing and ok and cancel button hiding automatically. – Sri Jun 26 '15 at 07:19
  • 3
    @Sri Can you add a screenshot illustrating your issue? Also, please show the parameter values used when you call `openQuestion(...)`. – Baz Jun 29 '15 at 07:51
  • Which OS are you using?Show us the parameter values for both working and not working? – Chandrayya G K Jun 29 '15 at 09:08
  • Chandrayya G K: Windows7 – Sri Jun 29 '15 at 09:18
  • 2
    @Sri If you want people to answer your question, it would be helpful if you'd answer their questions in the comments... – Baz Jun 30 '15 at 15:35

1 Answers1

1

No matter what I try ,not able to reproduce your issue.Its working perfectly fine for me even for big multi line string.Attached is the screen shot enter image description here

I guess there is some problem with the layout or size of the shell Object that you are passing Shell parentShell try sending null to the method just for the sake of testing the issue openQuestion(null, "Hello Testing", "Test String,1")

Also if you need my test code for reference here

Sarfaraz Khan
  • 2,166
  • 2
  • 14
  • 29