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

Messages - Kvaz1r

#46
Right, "vetoing" mechanism. Maybe it worth to mention about the behaviour in documentation or gather such non-always obvious questions in special FAQ topic on the forum.
#47
I have to retrieve some information from ChildWindow when it closing, but without calling destroy/0 the window doesn't disappear.

Here is MCVE:


#include <TGUI/TGUI.hpp>
#include <iostream>

class MyFrame
{
public:
    MyFrame()
    {
        window.create(sf::VideoMode(800, 600), "TGUI window");
        gui.setTarget(window);
        panel = tgui::Panel::create();
       
        auto b = tgui::Button::create();
        b->setText("Click");
        b->connect("pressed", [this]()
            {
                auto ptr = tgui::ChildWindow::create("Test");
                ptr->connect("Closed", [this, ptr]()
                    {
                        std::cout << ptr->getTitle().toAnsiString() << '\n';
                        //ptr->destroy();  // all works if uncomment
                    });
                panel->add(ptr);
            });
        panel->add(b);
        gui.add(panel);
    }
    void main()
    {
        while (window.isOpen())
        {
            sf::Event event;
            while (window.pollEvent(event))
            {
                if (event.type == sf::Event::Closed)
                    window.close();
                gui.handleEvent(event);
            }
            window.clear();
            gui.draw();
            window.display();
        }
    }

private:
    sf::RenderWindow window;
    tgui::Gui gui;

    tgui::Panel::Ptr panel;
};

int main()
{
    MyFrame().main();
}


Is it correct behaviour or I am doing something wrong and there is the right way for such situation?
#48
Yes it's totally understandable that such widget is very hard to implement.
As for RichTextControl is it possible to have also image support in it? Such type also can be used quite wide. 
#49
In GUI application often need provide some report for user and supporting HTML or at least md format so to have such widget would be really great. 
#50
Help requests / Re: Close button
06 October 2019, 23:21:15
I've never used own themes so I've no idea why your code crashed, but in standard theme them defined separately. What if you also do so?
In any case better provide sample for reproducing the behavior.
#51
Help requests / Re: Close button
06 October 2019, 18:27:46
Not sure about texture, but here code for changing color(from tests):

            tgui::ButtonRenderer closeButtonRenderer;
            closeButtonRenderer.setBackgroundColor(sf::Color::Red);
            ...
            ptr->getRenderer()->setCloseButton(closeButtonRenderer.getData());//ptr is pointer to your child window
#52
Help requests / Re: Close button
06 October 2019, 18:06:01
How exactly do you want modify it?
#53
1. +
2. It was a typo, of course I mean multiselect is false. But I was thought about explicit incorrect calls(wrong indexes, wrong mode,...). Is there need special strategy for handling such situation? 
#54
Ok, I've started working on it, there is several issue:
1. What to do if deselectItem/0 called with multiselect mode? Should I also to add deselectItem/1 or even deselectItems/1? 
2. What to do if user try to select several items when multiselect is true? Change mode or select only first?
#55
Yes, it doesn't seems hard, I will try to do it on the week.
As internal collection should I use std::set or std::vector and sort it in updateSelectedItem? I am not sure which one would fits here better.
#56
In some cases there is important to have opportunity select several items from the list (for example if its file picker dialog).
#57
Help requests / Re: Remove widget
22 September 2019, 19:09:19
You can use this forum. There isn't so much opened topics here but they could be quite helpful. And you always can create a new one ;-)
#58
Feature requests / Re: Visual Studio warnings
18 September 2019, 19:29:07
It's seems as false positive. mOwner can't be dereferencing with null  here because it initialize with same condition as mOwner itself.

But are you sure that you use latest version of compiler because I didn't get it for VS 16.2.5.
#59
Help requests / OOP and TGUI
17 September 2019, 11:58:45
I noticed that all examples use only "all in main" style. Is there any reason why it don't write in OOP-style?
Minimal example(it took for me a while before I realize how create Gui inside class):

#include <TGUI/TGUI.hpp>

class MyFrame
{
public:
    MyFrame(int argc, char* argv[]);
    void main();

protected:
    tgui::Button::Ptr m_Button;

private:
    sf::RenderWindow window;
    tgui::Gui gui;
};

MyFrame::MyFrame(int argc, char* argv[])
{
    window.create(sf::VideoMode(800, 600), "TGUI window");
    gui.setTarget(window);
    auto panel = tgui::ScrollablePanel::create();
    m_Button = tgui::Button::create("Press");
    panel->add(m_Button);
    gui.add(panel);
}

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

            else if (event.type == sf::Event::Resized)
            {
                window.setView(sf::View(sf::FloatRect(0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height))));
                gui.setView(window.getView());
            }
            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }
}

int main(int argc, char* argv[])
{
    MyFrame f(argc, argv);
    f.main();
}
#60
Feature requests / Re: Add table widget
16 September 2019, 19:54:03
great, thank you