Question

I have a selectionListener for a Tree (org.eclipse.swt.widgets.Tree.Tree). Should any selection occur in this widget, associated TreeItem (org.eclipse.swt.widgets.TreeItem) should be checked. I have used TreeItem's setChecked and setImage methods together to achieve this. It works as expected on Android. But iOS does not show the image(checked/unchecked) set for the TreeItem.

this.getPart().getTree().addSelectionListener( new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
        TreeItem item = (TreeItem) e.item;
        if ( item.getChecked() ) {
            item.setChecked( false );
            item.setImage( ResourceManager.getImage( LnfSettings.IMAGE_UNCHECKED ) );
        }
        else {
            item.setChecked( true );
            item.setImage( ResourceManager.getImage( LnfSettings.IMAGE_CHECKED ) );
        }
    } 
} );
Était-ce utile?

La solution

Tabris for iOS has no support (yet) for checked/unchecked in the tree. For iOS we would need the concept of "edit" which we don't have yet for this widget. It is implemented on Android, but not an official feature.

What are you trying to build? Maybe there is an other way to achieve your goal?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top