Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Melascry

Pages: [1]
1
Window / Re: Windows gains focus only at borded
« on: July 01, 2014, 11:02:41 am »
OOOOk that's why ^^

Thanks then, I'll do this ASAP :)

2
Window / Re: Windows gains focus only at borded
« on: July 01, 2014, 10:52:43 am »
Oh yeah that's not what I meant by a week old ^^'.

I downloaded the 2.1 libs less than a week ago, and that wasn't fix for me :/

Maybe someone can check on their version.

3
Window / Re: Windows gains focus only at borded
« on: June 30, 2014, 10:07:32 pm »
Just to add my solution.
This is a Windows only solution.

I actually found a coding solution which just gets around this problem. I don't know if it has been solved yet, but it was not working with my actual version for SFML, 2.1, less than a week old.

So to still get the sf::Event::GainedFocus when clicking in the middle of the window, is used an other event. The sf::Event::MouseEntered event.
It gets trigerred whether or not the window is on focus.
So all that is left is to detect the mouseClick Event.
Which is again trigerred even if the window isn't the focus.

Then to make the window the focus. No function from sfml is provided to force the focus on the window. But there is a win32 api call that does the trick. SetFocus(HWND HandleToTheWindow).

case sf::Event::MouseEntered:
{
        // Retrieving when the mouse gets in the window.
        mouseInScreen = true;
        break;
}
case sf::Event::MouseButtonReleased:
{
        if(mouseInScreen)
        {
                // make the window the current focus.
                SetFocus(this->window->getSystemHandle());
        }
}
 

The only downside, if considered one, is that it will send a lose focus event before sending the GainedFocus event.

I hope this helps anyone having this problem again. Or maybe giving the SFML guys some clue about how to get this fixed. :)

Pages: [1]