Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » column visibility
column visibility [message #8549] Mon, 14 August 2006 15:36 Go to next message
remi is currently offline remiFriend
Messages: 9
Registered: July 2009
Junior Member
Hello, I'am trying to hide/show a defined column of the Nebula Grid (12*3)
bellow that contains various GridEditor.
The problem is that even if the column visibility is set to false, the
column is still displayed on the screen.

May I miss something or is it a bug?
Thanks in advance

Rémi

************************************************************ ***********
Grid table = new Grid (top, SWT.BORDER | SWT.MULTI);
table.setLinesVisible (true);
table.setHeaderVisible(true);

final GridColumn myColumn1 = new GridColumn(table, SWT.NONE);
myColumn1.setWidth (100);
final GridColumn myColumn2 = new GridColumn(table, SWT.NONE);
myColumn2.setWidth (100);
final GridColumn myColumn3 = new GridColumn(table, SWT.NONE);
myColumn3.setWidth (100);

for (int i=0; i<12; i++) {
new GridItem (table, SWT.NONE);
}
GridItem [] items = table.getItems ();
for (int i=0; i<items.length; i++) {
GridEditor editor = new GridEditor (table);
CCombo combo = new CCombo (table, SWT.NONE);
combo.setText("CCombo");
combo.add("item 1");
combo.add("item 2");
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 0);
editor = new GridEditor (table);
Text text = new Text (table, SWT.NONE);
text.setText("Text");
editor.grabHorizontal = true;
editor.setEditor(text, items[i], 1);
editor = new GridEditor (table);
Button button = new Button (table, SWT.CHECK);
button.pack ();
editor.minimumWidth = button.getSize ().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor (button, items[i], 2);
}

final Button button = new Button(top, SWT.CHECK);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
System.out.println("we hide one column of the Nebula Grid");
System.out.println(button.getSelection());
myColumn1.setVisible(button.getSelection());
System.out.println(myColumn1.getVisible());
}
});
button.setText("Check Button");
************************************************************ ***********
Re: column visibility [message #9253 is a reply to message #8549] Mon, 14 August 2006 17:02 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Remi,

Column visibility is an unfinished feature at the moment. You can
workaround this by doing the following:

First, GridColumn.setVisible() isn't redrawing the grid. This can
easily be fixed by simply calling Grid.redraw(). Second, the GridEditor
doesn't have any concept of hidden columns. In order to handle this,
you'll need to set your editor controls visible/invisible when you make
the column visible/invisible. You will also likely have to call
GridEditor.layout() on all your editors when you make a column
visible/invisible.

When column visibility is finished, the appropriate events will be fired
and the GridEditor will know how to respond.

-Chris

remi wrote:
> Hello, I'am trying to hide/show a defined column of the Nebula Grid
> (12*3) bellow that contains various GridEditor.
> The problem is that even if the column visibility is set to false, the
> column is still displayed on the screen.
>
> May I miss something or is it a bug?
> Thanks in advance
>
> Rémi
>
> ************************************************************ ***********
> Grid table = new Grid (top, SWT.BORDER | SWT.MULTI);
> table.setLinesVisible (true);
> table.setHeaderVisible(true);
>
> final GridColumn myColumn1 = new GridColumn(table, SWT.NONE);
> myColumn1.setWidth (100);
> final GridColumn myColumn2 = new GridColumn(table, SWT.NONE);
> myColumn2.setWidth (100);
> final GridColumn myColumn3 = new GridColumn(table, SWT.NONE);
> myColumn3.setWidth (100);
>
> for (int i=0; i<12; i++) {
> new GridItem (table, SWT.NONE);
> }
> GridItem [] items = table.getItems ();
> for (int i=0; i<items.length; i++) {
> GridEditor editor = new GridEditor (table);
> CCombo combo = new CCombo (table, SWT.NONE);
> combo.setText("CCombo");
> combo.add("item 1");
> combo.add("item 2");
> editor.grabHorizontal = true;
> editor.setEditor(combo, items[i], 0);
> editor = new GridEditor (table);
> Text text = new Text (table, SWT.NONE);
> text.setText("Text");
> editor.grabHorizontal = true;
> editor.setEditor(text, items[i], 1);
> editor = new GridEditor (table);
> Button button = new Button (table, SWT.CHECK);
> button.pack ();
> editor.minimumWidth = button.getSize ().x;
> editor.horizontalAlignment = SWT.LEFT;
> editor.setEditor (button, items[i], 2);
> }
>
> final Button button = new Button(top, SWT.CHECK);
> button.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(final SelectionEvent e) {
> System.out.println("we hide one column of the Nebula
> Grid");
> System.out.println(button.getSelection());
> myColumn1.setVisible(button.getSelection());
> System.out.println(myColumn1.getVisible());
> }
> });
> button.setText("Check Button");
> ************************************************************ ***********
>
>
>
Re: column visibility [message #563959 is a reply to message #8549] Mon, 14 August 2006 17:02 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
Hi Remi,

Column visibility is an unfinished feature at the moment. You can
workaround this by doing the following:

First, GridColumn.setVisible() isn't redrawing the grid. This can
easily be fixed by simply calling Grid.redraw(). Second, the GridEditor
doesn't have any concept of hidden columns. In order to handle this,
you'll need to set your editor controls visible/invisible when you make
the column visible/invisible. You will also likely have to call
GridEditor.layout() on all your editors when you make a column
visible/invisible.

When column visibility is finished, the appropriate events will be fired
and the GridEditor will know how to respond.

-Chris

remi wrote:
> Hello, I'am trying to hide/show a defined column of the Nebula Grid
> (12*3) bellow that contains various GridEditor.
> The problem is that even if the column visibility is set to false, the
> column is still displayed on the screen.
>
> May I miss something or is it a bug?
> Thanks in advance
>
> Rémi
>
> ************************************************************ ***********
> Grid table = new Grid (top, SWT.BORDER | SWT.MULTI);
> table.setLinesVisible (true);
> table.setHeaderVisible(true);
>
> final GridColumn myColumn1 = new GridColumn(table, SWT.NONE);
> myColumn1.setWidth (100);
> final GridColumn myColumn2 = new GridColumn(table, SWT.NONE);
> myColumn2.setWidth (100);
> final GridColumn myColumn3 = new GridColumn(table, SWT.NONE);
> myColumn3.setWidth (100);
>
> for (int i=0; i<12; i++) {
> new GridItem (table, SWT.NONE);
> }
> GridItem [] items = table.getItems ();
> for (int i=0; i<items.length; i++) {
> GridEditor editor = new GridEditor (table);
> CCombo combo = new CCombo (table, SWT.NONE);
> combo.setText("CCombo");
> combo.add("item 1");
> combo.add("item 2");
> editor.grabHorizontal = true;
> editor.setEditor(combo, items[i], 0);
> editor = new GridEditor (table);
> Text text = new Text (table, SWT.NONE);
> text.setText("Text");
> editor.grabHorizontal = true;
> editor.setEditor(text, items[i], 1);
> editor = new GridEditor (table);
> Button button = new Button (table, SWT.CHECK);
> button.pack ();
> editor.minimumWidth = button.getSize ().x;
> editor.horizontalAlignment = SWT.LEFT;
> editor.setEditor (button, items[i], 2);
> }
>
> final Button button = new Button(top, SWT.CHECK);
> button.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(final SelectionEvent e) {
> System.out.println("we hide one column of the Nebula
> Grid");
> System.out.println(button.getSelection());
> myColumn1.setVisible(button.getSelection());
> System.out.println(myColumn1.getVisible());
> }
> });
> button.setText("Check Button");
> ************************************************************ ***********
>
>
>
Previous Topic:GridEditor issue
Next Topic:What about sorting ?
Goto Forum:
  


Current Time: Fri Nov 08 23:58:34 GMT 2024

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

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

Back to the top