"Murad Murad" <murat@tetracom.com> wrote in message
news:dqo88e$e8k$1@utils.eclipse.org...
> Hi,
> I'm trying to handle SWT.MouseWheel event for a simple Canvas object, but
> it doesn't work. I need this to zoom in/out an image. I need also to catch
> the drag event, is this SWT.DragDetect? Thanx!

I have a CTabFolder and I create CTabItem objects dynamically. Each
CTabItem object has only one contol, a Canvas. I have MouseManager for
Mouse events. Here is the sample code. All other events are caught but
MouseWheel is not.

The MouseWheel is going to the widget with focus. Canvas will not take
focus until you add a key listener. In the example below I have placed the
canvas in a CTabFolder and given it a key listener. When the shell first
opens, focus in the CTabFolder tab (see the focus rectangle around "hello")
If you click on the canvas (or tab into) the canvas will take focus. Then
the canvas will start receiving the mouse wheel events. (My previous
example worked because the canvas was the only widget in the shell and
therefore all events were going to it - in your case, CTabFolder can take
focus so you need to make your canvas take focus too).