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

#21
Menu items don't show when I press on a menu. Menubar is added into layout. Is this expected behaviour or bug? If it's first case - how to fix?

MCVE:

#include <TGUI/TGUI.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
tgui::Gui gui(window);
auto topLayout = tgui::VerticalLayout::create();
topLayout->setSize("100%", "10%");

tgui::MenuBar::Ptr menuBar = tgui::MenuBar::create();
menuBar->addMenu("File");
menuBar->addMenuItem("File", "New");

topLayout->add(menuBar);
topLayout->add(tgui::Button::create("Button"));
gui.add(topLayout);

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

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

window.clear();
gui.draw(); // Draw all widgets
window.display();
}
}
#22
It's a very common controls so it would be great have opportunity use them from builder.