Skip to content

When selecting multiple checkboxes at the same time (multi-touch) and those become disabled, not all selection listeners are notified #450

@evolanakis

Description

@evolanakis

Platforms: iOs and Android
Version: Tabris 1.5.0 / RAP 2.3.2

Snippet to reproduce:

package app;

import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

import com.eclipsesource.tabris.ui.AbstractPage;
import com.eclipsesource.tabris.ui.PageData;

@SuppressWarnings("serial")
public class TopLevelPage extends AbstractPage implements SelectionListener {

    private Button button1, button2, button3, button4;

    // To reproduce:
    // - touch several checkboxes (two or more) at the same time
    // - the widgetSelected code is only run once
    // - the widgetSelected code is NOT run for the buttons that have been disabled during run-1
    //
    // This is caused by the following code in RAP:
    // EventUtil.java:
    // private static boolean isAccessible( Control control ) {
    // return control.getEnabled() && control.getVisible() && isShellAccessible( control.getShell());
    // }
    
    @Override
    public void createContent(final Composite parent, PageData data) {
        GridLayoutFactory.swtDefaults().margins(44, 44).spacing(44, 44).numColumns(1).applyTo(parent);

        button1 = new Button(parent, SWT.CHECK);
        button1.setText("Checkbox 1");
        button1.addSelectionListener(this);

        button2 = new Button(parent, SWT.CHECK);
        button2.setText("Checkbox 2");
        button2.addSelectionListener(this);

        button3 = new Button(parent, SWT.CHECK);
        button3.setText("Checkbox 3");
        button3.addSelectionListener(this);

        button4 = new Button(parent, SWT.CHECK);
        button4.setText("Checkbox 4");
        button4.addSelectionListener(this);
    }

    @Override
    public void widgetSelected(SelectionEvent e) {
        System.out.println("** Widget selected: " + ((Button)e.widget).getText());
        button1.setEnabled(false);
        button2.setEnabled(false);
        button3.setEnabled(false);
        button4.setEnabled(false);
    }

    @Override
    public void widgetDefaultSelected(SelectionEvent e) {
        // unused
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions