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 - krolik

#1
Help requests / EditBox acts strange.
06 January 2019, 23:28:02
Hello!
I'm making a game using sfml + tgui, and for my level creator I need EditBoxes, so I made new tgui::Gui object for creator menu and loaded Widgets using loadWidgetsFromFile() function.
These Widget declarations in .txt file look like this:
Code (cpp) Select

EditBox.width {
    Position = (10, 40);
    DefaultText = "Number of cols...";
}

then, when in main menu I click button directing me to creator I'm calling this function in a loop:
Code (cpp) Select
void Menu::showEdit(sf::Event & event)
{
if (event.type == sf::Event::Closed)
window.close();
window.clear(sf::Color::White); // clear window with white color
editGui.handleEvent(event);
editGui.draw(); // drawing loaded widgets
window.display();
}

But with this code it doesn't work like it should, when I press any key loop manages to execute few times and I get a few characters instead of one, in addition, backspace doesn't work. I think I should change something in EditBok drawing, but I have run out of ideas, nothing seems to work so far. Could you give me some advice? I'm using TGUI 0.8. Thanks in advance :)