Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » sticky window?
sticky window? [message #418848] Thu, 12 February 2004 21:48 Go to next message
Eclipse UserFriend
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 #418862 is a reply to message #418848] Fri, 13 February 2004 07:49 Go to previous messageGo to next message
Eclipse UserFriend
Off the top of my head...(so I may be totally off the mark) You might
be able to set a flag in the controlMoved handler and start listening
for mouse up events. Then put the window back in the mouse up event
handler.

HTH,
Phil

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
>
Re: sticky window? [message #419073 is a reply to message #418848] Fri, 13 February 2004 14:04 Go to previous messageGo to next message
Eclipse UserFriend
Create a window without trim and he won't be able to move it?

"Tbee" <tibor@tssoft.com> wrote in message news:c0hdo3$a84$2@eclipse.org...
> 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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:swt_awt
Next Topic:How to use Treeviewer?
Goto Forum:
  


Current Time: Mon Oct 27 08:50:31 EDT 2025

Powered by FUDForum. Page generated in 0.03728 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top