Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table editor throws widget disposed error. Please help
Table editor throws widget disposed error. Please help [message #461476] Mon, 26 September 2005 04:22
Eclipse UserFriend
Originally posted by: deepu.sandblue.com

hello all,


i have an issue which i coudnt fix even after spending a lot of time. I am
not an expert in swt/jface, so i think i miss

something.


Here is a brief of my wizard page.

public class PresentationLayerWizardPage extends ModuleBaseWizardPage{

private Table viewEditTable; // Table control


public void createControl(Composite parent) {

// create a Tab control
// create a Tab Item

tabItem.setcontrol(getTableControl());


}



public void getTableControl(){

viewEditTable = new Table(scrollableComposite,SWT.SIMPLE|SWT.H_SCROLL |
SWT.V_SCROLL);
viewEditTable.getVerticalBar().setEnabled(true);
viewEditTable.setLinesVisible(true);
viewEditTable.setHeaderVisible(true);

// set Table columns


}

public void setVisible(boolean visible) {
if(visible){

this.viewEditTable.removeAll();
initializeTableGrid();
}
super.setVisible(visible);
}


public void initializeTableGrid(){
// create TableItem
// create a table editor
// create a check box

TableItem item = new TableItem(this.viewEditTable,SWT.NONE);

TableEditor teditor = new TableEditor(viewEditTable);
teditor.grabHorizontal = true;
Button editorcheckbox = new Button(viewEditTable, SWT.CHECK | SWT.CENTER);
editorcheckbox.setLayoutData(new
GridData(GridData.HORIZONTAL_ALIGN_CENTER));

// set back color same as table grid back color
editorcheckbox.setBackground(viewEditTable.getBackground());

// set editor checkbox, on the specified cell ( row = row, column =
optionType )
teditor.setEditor(editorcheckbox,item,1);
item.setText(1,option.getView().toString()); // set underlying column

editorcheckbox.setSelection(option.getView().booleanValue()) ; // set
userfriendlycontrol


editorcheckbox.addSelectionListener(new CheckBoxListener(item,1));



}


private class CheckBoxListener implements SelectionListener{
TableItem tableItem;
int index;

public CheckBoxListener(TableItem tableItem,int index){
this.tableItem = tableItem; // selected row
this.index = index; // selected column
}



public void widgetSelected(SelectionEvent e) {
tableItem.setText(index,""+((Button)e.widget).getSelection());


}


public void widgetDefaultSelected(SelectionEvent e) {

}
}
}


} // end of wizard class


First time everything works as i could check or uncheck the check boxes and
i am able to retrieve the status from it. please

look at the selection listner which set the TableItem.setText as the status
of the checkbox on each click.

Problem comes when i click 'back' button to go the same page and try to
chnage the check box status by clicking on it. Then

i got an exception saying 'Widget EXposed'. On debug i found that it causes
in the selctionListner when we try toset the

tableItem.setText on 'widgetSelected(SelectionEvent e)' method. I coudnt
figure out why and couldnt find a soltuins yet.
can anyone please give some ideas ??


Anyhelp would be highly appreaciated. Thanks a lot in advance.


regards
dsundar
Previous Topic:Transparent Window (SetLayeredWindowAttributes) without frame and controls
Next Topic:How can i get the real size of a Component?
Goto Forum:
  


Current Time: Thu Jun 20 05:18:41 GMT 2019

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

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

Back to the top