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

Author Topic: Cannot move 2nd window when created  (Read 1869 times)

0 Members and 1 Guest are viewing this topic.

Aether92

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Cannot move 2nd window when created
« on: September 12, 2013, 03:29:53 am »
I'm having a problem where I open up my game, the screen opens and when I hit exit a 2nd window opens asking if you're sure.
When this window spawns I cannot click and drag the box or click close when the box spawns on top of the 1st window.

Meaning if I spawn the 2nd window, click back to the 1st then drag it out of the way I can now click and move the window.

Also I've assigned a keypress so if you hit Return while this 2nd window is open it will close everything, this does work perfectly fine, the only problem is clicking and dragging the actual box.

The way I do it is...

                while (Game.pollEvent(Event))
                {
                        if ((Event.type == sf::Event::Closed) || (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt) && sf::Keyboard::isKeyPressed( sf::Keyboard::F4)) || (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)))
                        {
                                CreateExit(sf::VideoMode(300,100), sf::String("Exit?"));
                        }
                }

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

                                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Return))
                                {
                                        Game.close();
                                        ExitScreen.close();
                                }
                        }
                }

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Cannot move 2nd window when created
« Reply #1 on: September 12, 2013, 05:11:00 am »
I'm not sure exactly what your problem is (it sounds like something with events), but you really should not use a second window as a dialog for the user. SFML wasn't designed to make modal popups for the user. You should instead just create some sort of exit confirmation inside your main window and go from there (how many games do you see that create a separate popup window for confirmation?).
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor