| sticky window? [message #418848] |
Thu, 12 February 2004 21:48  |
Eclipse User |
|
|
|
How can I move back my application window to its original position when
users try to move it?
If I use
shell.addControlListener(new ControlAdapter() {
public void controlMoved(ControlEvent event) {
shell.setLocation(150,100);
}
});
it works, however it restores window location even while the window is
being dragged; It's quite disturbing. I want to move it back when the
user actually releases the mouse and drops the window.
Thanks
|
|
|
|
|
| Re: sticky window? [message #419080 is a reply to message #418848] |
Fri, 13 February 2004 16:28  |
Eclipse User |
|
|
|
Thanks Guys:
I've tried Phil's idea first:
shell.addControlListener(new ControlAdapter() {
public void controlMoved(ControlEvent event) {
moved = true;
}
});
shell.addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent me) {
if (moved) {
moved = false;
shell.setLocation(150,100);
}
}
});
I think you thought something like this, right?
This is correct syntactically but it doesn't work. Did I miss something?
Steve's solution is pretty easy, I'll do that unless someone from my
users complain..
My original style was:
shell = new Shell(display,SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER |
SWT.ON_TOP);
Now I use only:
shell = new Shell(display,SWT.SYSTEM_MODAL | SWT.BORDER | SWT.ON_TOP);
Thanks again.
(I am still curious though..)
Tbee wrote:
> How can I move back my application window to its original position when
> users try to move it?
> If I use
>
> shell.addControlListener(new ControlAdapter() {
> public void controlMoved(ControlEvent event) {
> shell.setLocation(150,100);
> }
> });
>
> it works, however it restores window location even while the window is
> being dragged; It's quite disturbing. I want to move it back when the
> user actually releases the mouse and drops the window.
>
> Thanks
>
|
|
|
Powered by
FUDForum. Page generated in 0.28080 seconds