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

#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
#61
Feature requests / Re: Add table widget
16 September 2019, 19:48:11
Yes, you're right, it's my mistake.
#62
Feature requests / Re: Add table widget
16 September 2019, 11:52:25
Right. So now it's only requires set "colour" functions setItemColor/updateSelectedAndhoveredItemColors/updateItemColors as virtual so it could be reused in inherited class. Is it possible?
#63
Feature requests / Re: Add table widget
14 September 2019, 19:41:43
Yes, I already started doing so but core problem is extend inner Item class. I'm not sure if it will be possible made the changes just extending functionality in inherit class. 
#64
Feature requests / Re: Add table widget
14 September 2019, 18:48:03
Unfortunately there isn't good way to provide additional properties even only for items. So I see 2 options:
1. Separate Item as Widget.
2. Create another control - table (or datagrid) widget, where every cell will separate widget. 
Of course there is also simple and dirty way, to expand Item with at least member for text color and use inner value instead of common property and after that replace protected function for changing color by public one:

    void ListView::setItemColor(std::size_t index, const Color& color, bool isForceUpdate)
    {
        for (auto& text : m_items[index].texts)
        {
            if (isForceUpdate)
                m_items[index].m_textColor = color;

            text.setColor(m_items[index].m_textColor);
        }
    }


@texus, how to do that better?
#65
Feature requests / Re: Add table widget
12 September 2019, 22:38:13
Well if provide only additional properties for items and not for cells I think it would good fit concept of listview. I can try to implement it myself, it doesn't seems really hard.
#66
Feature requests / Add table widget
12 September 2019, 17:22:44
ListView is very good control but it doesn't provide opportunity to change anything but text for cells or even rows.

So it would be great to have control where every cell (or at least rows) can change color(of text/background/borders). It's very common situation where one should separate data in table (like top 5 of something). 
#67
Feature requests / SpinCtrl
12 September 2019, 12:13:25
SpinCtrl is a popular control that combine SpinButton and one line TextBox. It's not so hard do it in user code but it would be much better to have it out of the box from library.
#68
Quote from: texus on 10 September 2019, 18:33:09
I actually added a way to temporarily disable a signal some time ago just for this kind of situation.
That's indeed cool and rarely feature.

Quote from: Ahnne Cognita on 10 September 2019, 18:59:30
I'm unable to disable the scrollbar entirely since the validation may only prevent one direction ie, still able to click/drag in the opposite. I could just use regular buttons and avoid the problem altogether.
Right, it was a long shot.
#69
Quote from: Ahnne Cognita on 10 September 2019, 14:49:44
Is it possible to set the value of a scrollbar without the Value Changed signal being triggered?
No, it's exactly purpose of the signal.

Quote from: Ahnne Cognita on 10 September 2019, 14:49:44
In my project, there's a situation where I need to do some validation before allowing the scrollbar's value to actually change. Currently, I'm using the Value Changed signal to begin the validation, but I haven't been able to find a way to force the scrollbar back to it's old value without triggering another Value Changed event.
There isn't any way to set custom validator to the control and check anything before changing. At least now, because it's really useful.
But I think you can bind your check to something else and make scrollbar disabled so one can't change it while state will not state as correct.
#70
Help requests / Re: vertical slider
08 September 2019, 12:56:42
Quote from: texus on 08 September 2019, 11:29:39
I'm not sure where to best document it.
I guess, or into detailed description or as comment to setSize usage example.

Quote from: texus on 08 September 2019, 11:29:39
Maybe we just need to add setVerticalScroll back, but still keeping the automatic detection based on size. So all existing code would still work, but you would also be able to call setVerticalScroll which would swap width and height values if they don't correspond to the requested direction. That way it might be more intuitive to use.
Yes, it would be great.
#71
Help requests / Re: vertical slider
08 September 2019, 10:39:56
I think it would be good to mention about how making slider vertical in documentation because it's not very obvious. 
I actually already wanted to create a new topic but decided use search first ;-)
#72
Quote from: texus on 07 September 2019, 12:50:20
I currently don't have any plans for it. I implemented the clicking signal because I believe it is a necessity for sorting columns. Other things like different colors, showing a small arrow inside the column header or even supporting sorting in the widget itself are extras that I am at this moment not going to spend my time on. I would love to see these things supported too, but I can't do everything at the same time.
I understand, it's not really important things and there are enough ways around it. 

Quote from: texus on 07 September 2019, 12:50:20
Btw, if you use ListBox or ComboBox widgets then you may want to download and rebuild TGUI again.

Yeah, thanks, I seen it.
#73
Yes, it works perfect. Is there any way to change background color of column header on click?
I see that it possible to change text for them, so they are already separated and I think it would be good have opportunity work with columns headers as with usual widgets. 
#74
Help requests / Re: List view
04 September 2019, 20:43:30
Yes. Here simple example how you can get item that was clicked, my compiler still doesn't recognize that filesystem is part of std so sorry about that  :)

#include <TGUI/TGUI.hpp>

#include <string>
#include <iostream>
#include <filesystem>

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

auto panel = tgui::ScrollablePanel::create();
auto listView = tgui::ListView::create();
listView->setExpandLastColumn(true);
listView->connect("ItemSelected", [listView](int id) {
std::cout << "Click on: ";
for (const auto& el : listView->getItemRow(id))
{
std::cout << std::string(el) << ' ';
}
std::cout << "\n\n";
});

listView->setSize({ "100%,100%" });
listView->addColumn(L"   ID   ");
listView->addColumn(L"   File   ");

std::string path = ".";
auto i = 0;
for (const auto& entry : std::experimental::filesystem::directory_iterator(path))
{
listView->addItem({ std::to_string(++i), entry.path().generic_string() });
}
panel->add(listView);
gui.add(panel);

// 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.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(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;
}

#75
Help requests / Re: List view
04 September 2019, 20:19:11
There is a documentation, so you can find there all available signals in section Public Attributes.