FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with a listener that moves a shell

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Sun Mar 11, 2007 9:09 am    Post subject: Need help with a listener that moves a shell Reply with quote

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.

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.
Back to top
View user's profile Send private message
WasserDragoon



Joined: 29 Sep 2007
Posts: 23
Location: Germany

PostPosted: Wed Apr 23, 2008 6:03 am    Post subject: Reply with quote

On this sample you can see a region shell with a background image which is moveable Wink
http://dsource.org/projects/dwt-samples/browser/user/region_shell.d#L92

WasserDragoon.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Sun May 04, 2008 6:14 pm    Post subject: Reply with quote

There was a fix at 7th april regarding the modifier constants.

http://www.dsource.org/projects/dwt-win/changeset/196%3A1e7701c27c03
Did that solve your problem meanwhile?
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Mon May 05, 2008 3:31 am    Post subject: Reply with quote

My post was over a year ago and since that I've seen better ways to do what I wanted to achieve and I have not tried my way again. But thanks for the replies.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Mon May 05, 2008 3:31 am    Post subject: Reply with quote

My post was over a year ago and since that I've seen better ways to do what I wanted to achieve and I have not tried my way again. But thanks for the replies.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Mon May 05, 2008 3:33 am    Post subject: Reply with quote

Oh sorry for the double post, I got some kind of error
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group