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.


Messages - Kvaz1r

Pages: [1] 2 3 4
1
Help requests / Re: listView and symbols
« on: 28 May 2020, 17:50:08 »
Do you use unicode character set in your project?
About the “Character set” option in Visual Studio

2
Help requests / Re: listView and symbols
« on: 28 May 2020, 16:59:34 »
It has nothing to do with ListView.
Use wide string for any non-Ascii symbols:

Code: [Select]
#include <TGUI/TGUI.hpp>

class MyFrame
{
public:
    MyFrame()
    {
        window.create(sf::VideoMode(800, 600), "MCVE");
        gui.setTarget(window);

        auto listView = tgui::ListView::create();
        listView->setSize(window.getSize().x, window.getSize().y);

        listView->addColumn(L"Key");
        listView->addColumn(L"Value");
        sf::String test = "test";
        test += L"€";
        listView->addItem({"0" ,test});

        gui.add(listView);
    }
    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();
        }
    }
    sf::RenderWindow window;
    tgui::Gui gui;
};

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

3
Help requests / Re: SFML drawing into a child window
« on: 27 May 2020, 15:09:41 »
Yes, it exactly the reason, thank you.

4
Help requests / Re: SFML drawing into a child window
« on: 27 May 2020, 14:10:42 »
Interesting topic, I (too?) not understand how to draw on tgui::Canvas.

I thought this code :

Code: [Select]
#include <TGUI/TGUI.hpp>

sf::VertexArray test_draw()
{
    sf::VertexArray test(sf::Quads, 4);
   
    test[0].position = sf::Vector2f(0, 0);
    test[0].color = sf::Color::Red;
    test[1].position = sf::Vector2f(50, 0);
    test[1].color = sf::Color::Red;
    test[2].position = sf::Vector2f(50, 70);
    test[2].color = sf::Color::Red;
    test[3].position = sf::Vector2f(0, 70);
    test[3].color = sf::Color::Red;
    return test;
}

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
tgui::Gui gui(window);

    auto panel = tgui::Panel::create();

    auto canvas = tgui::Canvas::create();
    canvas->clear();
    canvas->draw(test_draw());
    canvas->display();
    panel->add(canvas);

    gui.add(panel);

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.draw(test_draw()); //draw fine
window.display();
}
}

will draw red square but it doesn't draw anything. What am I missing?
Drawing via window (commented line) works fine. 

5
Help requests / Re: SFML drawing into a child window
« on: 26 May 2020, 23:52:09 »
Why not define class and keep your objects there?

6
The exception that you had in ProgressBar has nothing to do with this. That issue was already fixed.
You were also getting the GL_INVALID_OPERATION error, but there are two possibilities:
- Or it had nothing to do with the exception that you were getting and the GL_INVALID_OPERATION error was thus never fixed (I only fixed the exception issue).

I understand that that issue was fixed :)
And yes I was indeed wrong I remembered your comment about OpenGL error in Picture.cpp but not details so thought it was related.

7
I guess it's somewhere in Picture widget.
Could you run the tests and see which widget throw the exception to confirm? Or remove them one by one from your MCVE.

I have been getting this exception earlier (on older version of VS19) in tests but not always.

Maybe it have similar root to this one - Exception when creating ProgressBar

8
Help requests / Re: Slider thumb position
« on: 27 April 2020, 17:56:51 »
Can you provide more info about use case or maybe code  with demonstration example ? It's not very clear what exactly do you want.

As an option you can set some initial value and forbid change value less than this value in handling "valueChanged" signal.

9
Excellent, first option is easy so I'll go with it ;-)

10
I want to create listview that will place full width of window but without scrollbar when it's redundant.

MCVE:

Code: [Select]
#include <TGUI/TGUI.hpp>

class MyFrame
{
public:
    MyFrame()
    {
        window.create(sf::VideoMode(800, 600), "MCVE");
        gui.setTarget(window);

        auto listView = tgui::ListView::create();
        listView->setSize(window.getSize().x, window.getSize().y);

        listView->addColumn(L"Key");
        listView->addColumn(L"Value");

        listView->setColumnWidth(0, window.getSize().x * 0.2f);
        listView->setColumnWidth(1, window.getSize().x * 0.8f);

        gui.add(listView);
    }
    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();
        }
    }
    sf::RenderWindow window;
    tgui::Gui gui;
};

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

Is it possible?

11
Help requests / Re: Highlighting Keywords
« on: 31 January 2020, 21:33:33 »
As for Q2.
You could easily extend standard widget that it will fits your needs. 
For example so(here I just added custom callback for onEnterPressed):

Code: [Select]
#include <TGUI/TGUI.hpp>
#include <iostream>
#include <functional>

template<typename Func>
class MyEditBox : public tgui::EditBox
{
public:
    using Ptr = std::shared_ptr<MyEditBox<Func>> ; ///< Shared widget pointer

    MyEditBox(Func f) : tgui::EditBox() , m_callback(f) {}

    static Ptr create(Func f)
    {
        return std::make_shared<MyEditBox>(f);
    }

    void keyPressed(const sf::Event::KeyEvent& event) override
    {
        if (event.code == sf::Keyboard::Enter)
        {
            m_callback();
        }
        EditBox::keyPressed(event);
    }

private:
    Func m_callback;
};

class MyFrame
{
public:
    MyFrame()
    {
        window.create(sf::VideoMode(800, 600), "TGUI window");
        gui.setTarget(window);
        //you could activate here callback for button with usual connect
        //in runtime
        //and disconnect it after
        //or use bool variable as flag
        auto onEnter = []()
        {
            std::cout << "Entered was pressed";
        };
        auto edit = MyEditBox<decltype(onEnter)>::create(onEnter);

        gui.add(edit);
    }
    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;
};

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

Another option for anti-spam would be usual Timer that runs and made "Send" button enabled only after timeout. And handler for "pressed" signal made button disabled after sending a message.

Or, for example, all messages writes to internal buffer first and it flushed by timer.

Well there are really many ways to do it ;-)

12
Help requests / Re: Combobox signal
« on: 30 January 2020, 09:31:45 »
Code works well for me.
Could you rebuild TGUI with current master and check it again? This commit seems related to your issue.

13
Help requests / Re: Combobox signal
« on: 30 January 2020, 09:16:10 »
Could you provide minimal reproducible example?

14
It's not really crucial but I can try to implement it on this week.

15
It's a bit strange that multiline input widget hasn't support setting placeholder because some users really need a hint what they should input even for big textboxes. So it would be great to have such feature.

 

Pages: [1] 2 3 4