Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Grabbing mouse events
Grabbing mouse events [message #7876] Sun, 28 January 2007 10:35 Go to next message
issactrotts is currently offline  issactrotts
Messages: 2
Registered: January 2007
Location: Davis
Junior Member
I'm writing a 3D viewing application and have a question about how to do the event handling. When the user clicks in the viewing control and then drags, there is some code that rotates the scene. This works fine except that when the mouse goes outside of the control the rotation stops until the mouse comes back in. Does anyone here know how to keep making the events go to the GL control while the mouse is being dragged?

Thanks for any advice.

Issac
  • Attachment: main.cpp
    (Size: 2.65KB, Downloaded 368 times)
Re: Grabbing mouse events [message #7880 is a reply to message #7876] Sun, 28 January 2007 19:12 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Next time please post the while package zipped so that we can test the solution.... ("a testcase"...)

I think this should help:

    virtual void LeftDown(Point p, dword keyflags) {
        SetCapture();
    	pprev = p;
    }	
    
    virtual void MouseMove(Point p, dword keyflags) {
       if(IsCapture()) {
           int dx=p.x-pprev.x;
           int dy=p.y-pprev.y;    
           x_angle_deg += dx;
           y_angle_deg += dy;       
           pprev = p;
           this->Refresh();
       }
    }


(LeftUp and bool mousedown are not necessary here)

Mirek

Re: Grabbing mouse events [message #7882 is a reply to message #7880] Sun, 28 January 2007 22:13 Go to previous messageGo to next message
issactrotts is currently offline  issactrotts
Messages: 2
Registered: January 2007
Location: Davis
Junior Member
Hi Mirek,

SetCapture() works; thanks for your help. In the version of U++ I'm using (mingw 2007.1beta2.exe), there is no IsCapture() method or function so I kept the mousedown variable.

Issac



Re: Grabbing mouse events [message #7883 is a reply to message #7882] Sun, 28 January 2007 22:25 Go to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
I am sorry, the correct name is "HasCapture".

Mirek
Previous Topic: How to find the top-most window the mouse is over (Linux)?
Next Topic: Set or paint with transparent color?
Goto Forum:
  


Current Time: Wed May 15 03:39:15 CEST 2024

Total time taken to generate the page: 0.02721 seconds