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

Author Topic: [Solved] Windows message diaglog glitch  (Read 1589 times)

0 Members and 1 Guest are viewing this topic.

Pheonix

  • Newbie
  • *
  • Posts: 27
  • Using SFML 2.1 with Win/Visual C++ (Newbie !!!)
    • View Profile
[Solved] Windows message diaglog glitch
« on: February 04, 2014, 11:27:58 am »
Hi, there's a glitch when displaying a windows message with SFML. The message pops up as it should, but if you try to press 'OK' or drag the message window it doesn't work (it doesn't realize you're clicking it).

Sometimes though it does work (though rarely). If you focus back to the main application and then focus back on the message everything works.

Is there an easy way to fix this? Here's my code (it's just the basic SFML tutotial/test code with a MessageBoxA() in it.

#include <SFML/Graphics.hpp>
#include <Windows.h>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

        MessageBoxA(0,"Hello","World",0);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
               
    }

    return 0;
}

Thanks in advance.
« Last Edit: February 05, 2014, 01:24:03 am by Pheonix »
Using SFML 2.1 with Win/Visual C++ (Newbie !!!)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11029
    • View Profile
    • development blog
    • Email
Re: Windows message diaglog glitch
« Reply #1 on: February 04, 2014, 11:35:23 am »
What version of SFML are you using exactly? Might be related to the focus issue in SFML 2.1...

Also make sure that the non-SFML related message box call doesn't have some requirements (like processing certain events or  calling certain other WinAPI functions).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Pheonix

  • Newbie
  • *
  • Posts: 27
  • Using SFML 2.1 with Win/Visual C++ (Newbie !!!)
    • View Profile
Re: Windows message diaglog glitch
« Reply #2 on: February 04, 2014, 12:25:54 pm »
Hi, I am using 2.1 ... is this a problem??

It does seem to be a focus related problem..
Using SFML 2.1 with Win/Visual C++ (Newbie !!!)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11029
    • View Profile
    • development blog
    • Email
Re: Windows message diaglog glitch
« Reply #3 on: February 04, 2014, 12:43:04 pm »
You might want to build SFML from source and see if it fixes the issue.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Pheonix

  • Newbie
  • *
  • Posts: 27
  • Using SFML 2.1 with Win/Visual C++ (Newbie !!!)
    • View Profile
Re: Windows message diaglog glitch
« Reply #4 on: February 04, 2014, 03:12:13 pm »
Works well after building from source (and using dynamic)  ;D
Using SFML 2.1 with Win/Visual C++ (Newbie !!!)