Main Menu
Menu

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.

Show posts Menu

Topics - GaelSav

#1
Help requests / TGUI & SFML - "pressed" event
31 July 2017, 09:59:34
Hi guys,

I've been using TGUI and SFML since few months on a little game quizz I developped.

There's an issue I am not able to solve regarding the "pressed" event.

When the game starts, a first window appears where the user needs to input its username and click OK. Then the quizz starts. However, when I run the code, if the user clicks OK, nothing happens. I figured out that the user has to click AND to move the mouse so that the event is correctly triggered.

Here is the code responsible for creating the OK button and the associated connect function (please let me know if providing other extracts of the code would help better):

// Create the "Ok" button
tgui::Button::Ptr button = theme->load("Button");
button->setSize(windowWidth / 2, windowHeight / 6);
button->setPosition(windowWidth / 4, windowHeight * 7 / 10);
button->setText("Ok");
gui.add(button);

// Call the login function when the button is pressed
button->connect("pressed", login, editBoxUsername);

Any help on this one?   :-\