Two calls for one click? OSR

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Two calls for one click? OSR

Postby DoctorJohn » Sun May 22, 2016 9:56 am

Hey.
I'm developing an C++ program with an integrated OSR. I use the following code do simple left clicks...
Bizarrely I've to call this function twice on the same coordinates to get one single click (on those coords).
Is there something wrong with my little function?

Code: Select all
void leftClickOn(int x, int y) {
    CefMouseEvent cme;
    cme.x = x;
    cme.y = y;
    offscreen_client->GetBrowser()->GetHost()->SendMouseClickEvent(cme, MBT_LEFT, true, 1);
    offscreen_client->GetBrowser()->GetHost()->SendMouseClickEvent(cme, MBT_LEFT, false, 1);
}


It looks like the first call of my function only moves the "cursor" and the second call actually performs the click.

Thanks in advance for any suggestion/hint/help.
DoctorJohn
Newbie
 
Posts: 7
Joined: Wed Mar 16, 2016 2:54 pm

Re: Two calls for one click? OSR

Postby amaitland » Sun May 22, 2016 4:26 pm

DoctorJohn wrote:Bizarrely I've to call this function twice on the same coordinates to get one single click (on those coords).


That's expected, a mouse click consists of a mouse button down and a corresponding mouse button up.

See viewtopic.php?f=6&t=13220 for some more info.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1291
Joined: Wed Jan 14, 2015 2:35 am

Re: Two calls for one click? OSR

Postby DoctorJohn » Sun May 22, 2016 4:44 pm

amaitland wrote:
DoctorJohn wrote:Bizarrely I've to call this function twice on the same coordinates to get one single click (on those coords).


That's expected, a mouse click consists of a mouse button down and a corresponding mouse button up.

See viewtopic.php?f=6&t=13220 for some more info.


Oh. Never mind. Thanks a lot!
I see... in fact the only bizarre thing is how I managed to confuse true and false.
DoctorJohn
Newbie
 
Posts: 7
Joined: Wed Mar 16, 2016 2:54 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 39 guests