Home » Eclipse Projects » Nebula » column visibility
column visibility [message #8549] |
Mon, 14 August 2006 15:36 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
remi![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=rpurguette%40groupemutuel.ch) 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 Go to previous message](theme/Solstice/images/up.png) |
Chris Gross![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=cgross%40elementriver.com) 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 Go to previous message](theme/Solstice/images/up.png) |
Chris Gross![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=schtoo%40schtoo.com) 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");
> ************************************************************ ***********
>
>
>
|
|
|
Goto Forum:
Current Time: Sun Sep 01 04:15:27 GMT 2024
Powered by FUDForum. Page generated in 0.03158 seconds
|