Search code examples
tabris

SetImage on TreeItem does not work in Tabris iOS7 client


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 ) );
        }
    } 
} );

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?