Home » Eclipse Projects » Nebula » column visibility
column visibility [message #8549] |
Mon, 14 August 2006 11:36  |
Eclipse User |
|
|
|
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 13:02  |
Eclipse User |
|
|
|
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 13:02  |
Eclipse User |
|
|
|
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");
> ************************************************************ ***********
>
>
>
|
|
|
Goto Forum:
Current Time: Mon Apr 28 02:24:19 EDT 2025
Powered by FUDForum. Page generated in 0.02671 seconds
|