|
|
Re: How to give a user feedback during a Tracker drag [message #514782 is a reply to message #514572] |
Tue, 16 February 2010 10:55   |
Eclipse User |
|
|
|
Hi Mark,
You should not have to do anything special here, I think you're seeing a
bug. The snippet below updates a Label and a TableItem with the Tracker's x
value. On win32 and OSX both of these controls update successfully, but on
GTK only the Label updates, the TableItem does not. I assume you're using
Linux or Solaris?
I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=302961 . In the
meantime, maybe you could work around this by using a Control like Label
that stays responsive while the Tracker is open?
public static void main (String [] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
final Label label = new Label(shell, SWT.NONE);
label.setBounds(10,10,100,30);
label.setText("label");
Table table = new Table(shell, SWT.NONE);
table.setBounds(10,50,100,50);
final TableItem item = new TableItem(table, SWT.NONE);
shell.open ();
shell.addListener (SWT.MouseDown, new Listener () {
public void handleEvent (Event e) {
Tracker tracker = new Tracker (shell, SWT.NONE);
tracker.setRectangles (new Rectangle [] {
new Rectangle (e.x, e.y, 100, 100),
});
tracker.addListener(SWT.Move, new Listener() {
public void handleEvent(Event event) {
System.out.println(event.x);
String string = String.valueOf(event.x);
label.setText(string);
item.setText(string);
}
});
tracker.open ();
}
});
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
Grant
"Mark" <Mark.Fenbers@noaa.gov> wrote in message
news:hlc7vj$gn1$1@build.eclipse.org...
> My program uses the "Tracker" widget to let users drag a box around the
window. The software lacks a means of providing feedback to the user as to
the exact location of the box they are dragging. In the Tracker's
ControlMoved handler/listener, I can write out these coordinates to the
console, but when I try to update the GUI, say through a ToolTip or through
a table cell, the update is blocked until the user releases the mouse button
(i.e., "drops" the Tracker).
>
> I tried putting the Tracker object in a new Runnable using "syncExec()",
but that provided no improvement over the problem. What must I do to have
GUI elements update on-the-fly while a Tracker widget is being dragged by
the user?
>
> Mark
|
|
|
|
Re: How to give a user feedback during a Tracker drag [message #515422 is a reply to message #514782] |
Thu, 18 February 2010 12:54  |
Eclipse User |
|
|
|
Thanks, Grant. I have not tried updating a label -- only a tool-tip and a table cell. I verified that the code was at least being reached because it outputs to System.err just fine during a Tracker drag. So I will try a label as a possible means as a temporary work-around until the apparent bug gets fixed.
Thanks for opening a ticket...
Mark
|
|
|
Powered by
FUDForum. Page generated in 0.27181 seconds