Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » ComboBoxCellEditor trims text when style is set to SWT.BORDER | SWT.READ_ONLY
ComboBoxCellEditor trims text when style is set to SWT.BORDER | SWT.READ_ONLY [message #1228938] Wed, 08 January 2014 11:36
Ana H is currently offline Ana HFriend
Messages: 7
Registered: February 2012
Junior Member
Hi!

Has anyone had a problem when using a combobox in a table viewer and setting SWT.BORDER | SWT.READ_ONLY style bits? My text gets trimmed to 10-11 characters, and the rest of the text is hidden although there is enough space to display it.

http://img812.imageshack.us/img812/6962/25bp.jpg

I've noticed that this only occurs if I set both BORDER and READ_ONLY styles, otherwise if only border or just read-only is set, then the text is displayed correctly. Also this only occurs with ComboBoxCellEditor, if I use a CCombo outside a tableViewer then it works correctly.

A simple example which produces this problem:
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));

    // TableViewer
    TableViewer tableViewer = new TableViewer(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.V_SCROLL);

    // Set up the table
    Table table = tableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Table columns    
    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
    column.getColumn().setWidth(200);
    column.getColumn().setText(NAME);
    column.getColumn().setResizable(true);
	
    column = new TableViewerColumn(tableViewer, SWT.NONE);
    column.getColumn().setWidth(250);
    column.getColumn().setText(LONG_TEXT_COLUMN);
    column.getColumn().setResizable(true);
    column.setEditingSupport(new ComboEditingSupport(tableViewer));
    
    // Set up content/label provider
    tableViewer.setContentProvider(new PersonContentProvider());
    tableViewer.setLabelProvider(new PersonLabelProvider());
    tableViewer.setInput(people);


And then in editing support I have:
    protected CellEditor getCellEditor(Object element) {
		return new ComboBoxCellEditor(viewer.getTable(), 
				someArray, 
				SWT.BORDER | SWT.READ_ONLY);
    }


Any thoughts how to workaround this?

[Updated on: Wed, 08 January 2014 11:39]

Report message to a moderator

Previous Topic:TableViewer programmatic selection binding problem
Next Topic:JFace databinding issues after migration
Goto Forum:
  


Current Time: Fri Apr 19 15:48:04 GMT 2024

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

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

Back to the top