www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Need help with a listener that moves a shell

reply doob <doobnet gmail.com> writes:
What I try to do is a listener that moves a shell by holding down the middle
mouse button. I want this because I use the style DWT.NONE on the shell. I
manged to do this in java and swt but the same code doesn't work as expected in
d with dwt. The code:

private class MouseListenerMiddle : Listener
{
        private int startX = 0;
        private int startY = 0;
                
        public void handleEvent (Event e)
        {
                if (e.type == DWT.MouseDown && e.button == 2)
                {
                        startX = e.x;
                        startY = e.y;
                }
                
                if (e.type == DWT.MouseMove && (e.stateMask & DWT.BUTTON2) != 0)
                {
                        Point p = shell.toDisplay(e.x, e.y);
                        p.x -= startX;
                        p.y -= startY;
                        shell.setLocation(p);
                }
        }
}

I can describe the problem with an example:
If you have the mouse pointer 100 pixels to the right of the top left corner of
a window and moves the window you expect that the mouse pointer always is 100
pixels to the right of the top left corner but now it isn't. The top left
corner of the window moves to the mouse pointer all the time.
Mar 11 2007
parent reply torhu <fake address.dude> writes:
doob wrote:
 What I try to do is a listener that moves a shell by holding down the middle
mouse button. I want this because I use the style DWT.NONE on the shell. I
manged to do this in java and swt but the same code doesn't work as expected in
d with dwt.
I don't know, but maybe you can try the forum. You have to be registered at dsource, I think, to post. http://www.dsource.org/forums/viewforum.php?f=1 Not many people are using dwt, since it seems to be a dead project. Your problem might be caused by a bug in dwt, to fix it you would have debug dwt yourself. A new port is on the way here, currently only the linux version is progressing. http://www.dsource.org/projects/tioport Hope this helps.
Mar 11 2007
parent doob <doobnet gmail.com> writes:
Actually it doesn't, I've notice that dwt seems dead and I thought I had a
better luck here than in the forum and I'm really looking forward to tioport,
but thanks for the replay anyway

torhu Wrote:

 doob wrote:
 What I try to do is a listener that moves a shell by holding down the middle
mouse button. I want this because I use the style DWT.NONE on the shell. I
manged to do this in java and swt but the same code doesn't work as expected in
d with dwt.
I don't know, but maybe you can try the forum. You have to be registered at dsource, I think, to post. http://www.dsource.org/forums/viewforum.php?f=1 Not many people are using dwt, since it seems to be a dead project. Your problem might be caused by a bug in dwt, to fix it you would have debug dwt yourself. A new port is on the way here, currently only the linux version is progressing. http://www.dsource.org/projects/tioport Hope this helps.
Mar 11 2007