| 
| special Jface dialog [message #329230] | Mon, 16 June 2008 19:03  |  | 
| Eclipse User  |  |  |  |  | Hello All, 
 Goal: Create a JFace dialog with a SWT text widget and the okay and cancel
 buttons such that when the user types text, the dialog and the text area
 expand/shrink according to the width and height of the text.
 
 private Text	textArea;
 
 I am using a gridlayout:
 textArea.setLayoutData(new GridData(GridData.FILL_BOTH));
 
 I can get the textarea to expand/shrink using the following code:
 textArea.setSize(textArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
 
 I have put this code in the modify event of the textarea. But I think
 there might be a better place to put this. Any ideas?
 I could not find a way to shrink/expand the dialog. The only place where I
 can set the size of the dialog is in the configureShell(Shell shell)
 function. But this sets the size only once when creating the dialog.
 
 I also tried to do the following in the createContents(composite parent)
 function:
 getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
 
 this also sets the size once. How do I resize the dialog and keep it in
 sync with the textarea. It is better in this case to use just a shell? and
 not a JFace dialog?
 
 Thanks.
 |  |  |  | 
|  | 
|  | 
Powered by 
FUDForum. Page generated in 0.03584 seconds