Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 133243 - Table/Tree inconsistency - Measure/Erase/PaintItem events on mouseover
Summary: Table/Tree inconsistency - Measure/Erase/PaintItem events on mouseover
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-25 00:47 EST by Rutger Ovidius CLA
Modified: 2019-09-04 03:01 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rutger Ovidius CLA 2006-03-25 00:47:33 EST
SWT Win32 CVS

In the following snippet, the Table receives a ton of Erase/Measure/PaintItem events as you move the mouse over top of it (or move another window on top of this Shell), while the Tree does not receive any.

I don't know which is correct, nor how to correctly use these events yet, but it seemed inconsistent.


 public static void main(String[] args) {
    final Display display = new Display();

    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    final int columns = 3;
    final int itemCount = 10;
    final int colWidth = 175;

    // --
    final Tree tree = new Tree(shell, SWT.BORDER | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    for (int i = 0; i < columns; i++) {
      TreeColumn tc = new TreeColumn(tree, SWT.LEFT);
      tc.setText(i + " " + tc.toString());
      tc.setWidth(colWidth);
      tc.setMoveable(true);
    }

    tree.setSortDirection(SWT.DOWN);
    tree.setSortColumn(tree.getColumn(0));
    tree.setItemCount(itemCount);

    tree.addListener(SWT.SetData, new Listener() {
      public void handleEvent(Event event) {
        System.err.println("SetData:\tIndex: " + event.index + " Item: " + event.item + " Event: " + event);
        TreeItem item = (TreeItem) event.item;
        String text = String.valueOf(event.index);
        for (int i = 0; i <= columns; i++) {
          item.setText(i, text + i + " " + item.toString());
        }
      }
    });

    // --
    final Table table = new Table(shell, SWT.BORDER | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    for (int i = 0; i < columns; i++) {
      TableColumn tc = new TableColumn(table, SWT.LEFT);
      tc.setText(i + " " + tc.toString());
      tc.setWidth(colWidth);
      tc.setMoveable(true);
    }

    table.setSortDirection(SWT.DOWN);
    table.setSortColumn(table.getColumn(0));
    table.setItemCount(itemCount);

    table.addListener(SWT.SetData, new Listener() {
      public void handleEvent(Event event) {
        System.err.println("SetData:\tIndex: " + event.index + " Item: " + event.item + " Event: " + event);
        TableItem item = (TableItem) event.item;
        String text = String.valueOf(event.index);
        for (int i = 0; i <= columns; i++) {
          item.setText(i, text + " " + item.toString());
        }
      }
    });

    // --
    Listener l = new Listener() {
      public void handleEvent(Event event) {
        String eventName = "";
        switch (event.type) {
          case SWT.MeasureItem :
            eventName = "MeasureItem";
            break;
          case SWT.EraseItem :
            eventName = "EraseItem";
            break;
          case SWT.PaintItem :
            eventName = "PaintItem";
            break;
        }

        System.err.println(eventName + "\tIndex: " + event.index + " Item: " + event.item + " Event: "
            + event);
      }
    };

    tree.addListener(SWT.MeasureItem, l);
    tree.addListener(SWT.EraseItem, l);
    tree.addListener(SWT.PaintItem, l);

    table.addListener(SWT.MeasureItem, l);
    table.addListener(SWT.EraseItem, l);
    table.addListener(SWT.PaintItem, l);

    shell.setSize(800, 600);
    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
Comment 1 Lars Vogel CLA 2019-09-04 03:01:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it and remove the stalebug whiteboard tag. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--