[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Please Help: Detecting swt-composite via mouse-event

Hi there,

I need some help with this issue:
I have to write an UI where the user is allowed to schedule appointments.
Therefor, I sublcassed swt-canvas, wich draws a grid. My canvas is embedded within a ScrolledComposite.
Each appointment is represented by a subclass of Composite.
I registered a MouseListener at the ScrolledComposite and thus enabling the user to move the "appointments" ( a.k.a. one specific Composite which i instantiated and passed over to the MouseListener of the ScrolledComposite for testing purposes) to specified rows and columns.
This works fine so far, but my code until now isn't anything more than a raw sketch.
Of course there is a need for my scheduler to notify which of the composites has been "grabbed" with the mouse, e.g. when the mouse hovers over it and a mousedown-event occurs.
But I'm not able to do this, since I have to set the enabled()-property of the canvas to "false" in order to have the ScrolledComposite's mouselistener to react.
And I cannot register a MouseTrackListener to the appointment-composites, since they are direct children of the disabled canvas.


So, basically, what I'm trying to accomplish is something like a chess game, there's a grid and I want to let the user move the elements on the "chess board".

Any help (e.g. pseudo-code) would be great. The elements that have to be involved are:

1) a canvas on which the grid is drawn
2) a scrolledcomposite which holds the canvas
3) several composites which represent an element that can be moved.

Thanks,

Boris Munivrana