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

Author Topic: TGUI & SFML - "pressed" event  (Read 1632 times)

0 Members and 1 Guest are viewing this topic.

GaelSav

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
TGUI & SFML - "pressed" event
« on: July 30, 2017, 07:43:55 pm »
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:

// 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?  :-[

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: TGUI & SFML - "pressed" event
« Reply #1 on: July 30, 2017, 10:11:31 pm »
TGUI has his own forum (https://forum.tgui.eu/) and the creator Texus is very usally very active there.

Also the code you provided does not show the actual callback of the button.


AlexAUT

GaelSav

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: TGUI & SFML - "pressed" event
« Reply #2 on: July 31, 2017, 09:49:38 am »
Ok will try to post there then. Cheers