|
|
Re: org.eclipse.swt.widgets.Tracker [message #524494 is a reply to message #523363] |
Thu, 01 April 2010 02:50 |
Andreas Schmid Messages: 17 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
--------------010809040301010803000601
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Am 26.03.2010 09:00, schrieb Praveen:
> Andreas Schmid wrote:
>> The tracker is going to resize itself, like i move the mouse (what i
>> am not doing)
> I mostly use NX client for connecting to my Ubuntu machine and I have
> never seen such problem with Tracker. Can you point me to a SWT code
> snippet you are trying to work with Tracker, so that I shall try to
> reproduce your scenario here ?
Sorry for the late reply.
I just created this Snippet for you. Hope you can reproduce the behavior.
Thanks
Andreas
--------------010809040301010803000601
Content-Type: text/plain;
name="TrackerSnippet.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="TrackerSnippet.java"
package de.it4vet.snippets
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tracker;
/**
* Short snippet to show missbehavior of Tracker under NX Client
* As long as i use MS it works. But if i am running it under NX Client and
* a Suse OS, the tracker is Moving like I move the mouse what i am not doing.
* It doesn't happen all the time.. Mostly it happens wenn i move the mouse quite
* fast.
* @author <a href="andreas@schmid-solutions.de">Andreas Schmid</a>
* @since 01.04.2010
*/
public class TrackerSnippet {
private static Tracker tracker;
private static Display display;
private static Shell shell;
private static final MouseListener trackerListener = new MouseAdapter(){
public void mouseDown(MouseEvent event) {
if(event.button == 1){
Rectangle rect = display.map((Control) event.widget, shell, event.x, event.y, 0, 0);
tracker.setRectangles(new Rectangle[] { rect });
tracker.open();
}
}
};
public static void main(String[] args) {
display = new Display();
shell = new Shell(display);
tracker = new Tracker(shell, SWT.RESIZE);
for (int a = 0; a < 9; a++) {
Group g = new Group(shell, SWT.BORDER);
g.setText("Group" + a);
g.setLayout(new GridLayout(3, true));
for (int b = 0; b < 9; b++) {
Label label = new Label(g, SWT.BORDER);
label.setText("Label: " + b);
label.addMouseListener(trackerListener);
}
g.addMouseListener(trackerListener);
}
GridLayout layout = new GridLayout(3, true);
shell.setLayout(layout);
shell.pack();
shell.addMouseListener(trackerListener);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
--------------010809040301010803000601--
|
|
|
|
Powered by
FUDForum. Page generated in 0.03281 seconds