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

#1
Hey there,

I've just tested tgui on Android and it works well, Buttons and callbacks do what they need to do. But when I create a EditBox there are some problems. Firtly it appears as normal in the App-Display, when I set a Text from code it'll also appear, but as soon as I tap with my finger on the EditBox to type in sth. the App crashes with the standart Android error msg: "Unfortunately, TheApp has stopped."

Here is my Code:


auto editBox = std::make_shared<tgui::EditBox>();
editBox ->setSize(700, 100);
editBox ->setPosition(10, 500);
// editBox ->setText("Some Text");
GUI->add(editBox );


At least the virtual keyboard on Android appears, then after like one second it crashes.
I already tryed other keyboards (Googles Keyboard & Samsung Keyboard).
My first try was to compile the 0.7-tgui release. After I got the error I compiled the current code from Github.
Both didn't work.

Have you any solutions fir this problem?
#2
Hey there,
I'm using the precompiled TGUI v0.7-alpha2 for Visual C++14 (2015) 32 bit with SFML-2.3.2. I have linked it static.
Since I just had started using this awesome library, I copied the example code (https://tgui.eu/example-code/v0.7/scalable-login-screen/) for the scalable login screen and modified it to produce the error.
The scalable screen worked well when I directly attached the widgets to the gui like in the original example, but when I have started using the tgui::VerticalLayout things get a bit wired.
When I uncomment line 21 where I insert a space in between the two buttons in the layout, it will throw a assertion error when you scale the window on the y axis. Scaling on the x axis works perfectly. It also works perfect if there is no space in the layout or if I don't use a layout at all.

The error occours in line 56 when gui.setView(window.getView()); is called.

The exact error:

Debug Assertion Failed!
File: [...]\Microsoft Visual Studio\14.0\VC\include\vector
Line: 101
Vector iterator not incrementable


The release mode will also throw an error, but a little bit different.

The code used to get this error:
(mostly the example)
#include <TGUI/TGUI.hpp>

void loadWidgets(tgui::Gui& gui)
{
// Create GUI
// Update size on window resize
auto windowWidth = tgui::bindWidth(gui);
auto windowHeight = tgui::bindHeight(gui);

// Vertical Layout
auto MenuLayout = std::make_shared<tgui::VerticalLayout>();
MenuLayout->setSize(windowWidth * 0.6f, windowHeight * 0.8f);
MenuLayout->setPosition(windowWidth * 0.2f, windowHeight * 0.1f);
gui.add(MenuLayout);

// Play Button
auto PlayBtn = std::make_shared<tgui::Button>();
//MenuLayout->add(PlayBtn);

/* ### Error line ### */
MenuLayout->addSpace(0.5f);

// Exit Button
auto ExitBtn = std::make_shared<tgui::Button>();
MenuLayout->add(ExitBtn);
}

int main()
{
// Create the window
sf::RenderWindow window(sf::VideoMode(400, 300), "TGUI window");
tgui::Gui gui(window);

try {
// Load the font
gui.setFont("Arial.ttf");

// Load the widgets
loadWidgets(gui);
} catch(const tgui::Exception& e) {
std::cerr << "Failed to load TGUI widgets: " << e.what() << std::endl;
return 1;
}

// Main loop
while(window.isOpen()) {
sf::Event event;
while(window.pollEvent(event)) {
// When the window is closed, the application ends
if(event.type == sf::Event::Closed)
window.close();

// When the window is resized, the view is changed
else if(event.type == sf::Event::Resized) {
window.setView(sf::View(sf::FloatRect(0, 0, event.size.width, event.size.height)));
gui.setView(window.getView());
}

// Pass the event to all the widgets
gui.handleEvent(event);
}

window.clear();

// Draw all created widgets
gui.draw();

window.display();
}

return EXIT_SUCCESS;
}


Thanks for your help :)

cookie