1

I am working on the Nebula Grid Table. The string that I am returning to the getToolTipText() method does not fit in the multiline, meanwhile it is showing in the single line. I am using the following code to achieve the Multiline toooltip. But still I am getting that string in the single line.

ColumnViewerToolTipSupport toolTipSupport = new ColumnViewerToolTipSupport(col.getViewer(), SWT.NONE, false) {
        @Override
        protected Composite createToolTipContentArea(Event event, Composite parent) {
            Composite comp = new Composite(parent, SWT.NONE);
            comp.setLayout(new FillLayout());
            comp.setBounds(0, 0, 250, 250);

            Text b = new Text(comp, SWT.LEFT);
            b.setText(getText(event));
            Activator.log("Text: " + getText(event), Status.INFO);
            b.setBackground(new Color(null, 255, 0, 0));
            b.setSize(250, 250);
            // b.addSelectionListener(new SelectionAdapter() {
            // @Override
            // public void widgetSelected(SelectionEvent e) {
            // hide();
            // MessageBox box = new MessageBox(.getShell(),SWT.ICON_INFORMATION);
            // box.setMessage("Hello World!");
            // box.setText("Hello World");
            // box.open();
            // }
            // });
            return comp;
        }



    };
greg-449
  • 109,219
  • 232
  • 102
  • 145

1 Answers1

2

You need to specify the SWT.MULTI style on the Text control if you want multiple line support.

Also specify the SWT.WRAP style if you want long lines wrapped.

So:

Text b = new Text(comp, SWT.LEFT | SWT.MULTI | SWT.WRAP);
greg-449
  • 109,219
  • 232
  • 102
  • 145