Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Input Dialog - Textarea
Input Dialog - Textarea [message #650558] Tue, 25 January 2011 14:19 Go to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
I need a dialog for simple textinput.
The text could be relative long, so I need a bigger textarea than the one row taxtarea of the Input Dialog.
Can I make that textarea bigger, or do I have to write my own Dialog?
If so, how do i create a bigger textarea?

Thanks in advance.
Re: Input Dialog - Textarea [message #650641 is a reply to message #650558] Tue, 25 January 2011 19:29 Go to previous message
Carsten Habicht is currently offline Carsten HabichtFriend
Messages: 14
Registered: January 2011
Junior Member
You don't have to: the InputDialog is meant to be subclassed. Smile
Here is what I'd write it if I didn't have to fear anybody ever reading the code:

        InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "Test", "Please input text.",
            "Test-Text", null) {

          /**
           * Override this method to make the text field multilined
           * and give it a scroll bar. But...
           */
          @Override
          protected int getInputTextStyle() {
            return SWT.MULTI | SWT.BORDER | SWT.V_SCROLL;
          }

          /**
           * ...it still is just one line high.
           * This hack is not very nice, but at least it gets the job done... ;o)
           */
          @Override
          protected Control createDialogArea(Composite parent) {
            Control res = super.createDialogArea(parent);
            ((GridData) this.getText().getLayoutData()).heightHint = 100;
            return res;
          }
        };
        dlg.open();


Sylphen - Ihr Systemhaus in Mittelhessen - http://www.sylphen.com/
Previous Topic:StructuredViewer useHashlookup
Next Topic:[Drag and Drop] DnD within same TreeViewer
Goto Forum:
  


Current Time: Mon Dec 22 12:45:47 GMT 2014

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

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