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

Pages: [1] 2
Got it, thank you! I will implement it like this for now and will wait until you add this future.

How I can change checkboxes texture to "TextureUncheckedHover" or "TextureCheckedHover" when mouse hovers the text?

but you could just replace the text with an actual Label widget for now.

I did so, but the checkbox texture no longer responds to mouse actions on text

I'm drawing radio buttons and check boxes to scrollable panel with fixed width (scrollablePanel.setHorizontalScrollbarPolicy(tgui::Scrollbar::Policy::Never)). Some of them have long texts and go beyond the borders of the panel. I think it would be useful to add the ability to automatically change the width of the text like in Label.
Here is example of what I have:

Help requests / Re: Binding MaximumTextWidth
« on: 19 May 2020, 12:12:45 »
I seem to figure it out ;D. I just have to update maximum text width every time widget changes its size.

Help requests / Binding MaximumTextWidth
« on: 19 May 2020, 10:38:46 »
How can I bind Labels MaximumTextWidth on widgets width? I'm making custom slider with it's name and value shown above.
Here is what I have for now:
class MyTguiSlider : public Panel
                typedef std::shared_ptr<MyTguiSlider> Ptr;
                typedef std::shared_ptr<const MyTguiSlider> ConstPtr;

                MyTguiSlider(const sf::String& name, const Layout width = { "100%"});
                ~MyTguiSlider() {};

                static MyTguiSlider::Ptr create(const sf::String& name, const Layout width = { "100%" });

                Label::Ptr m_nameLabel;
                Label::Ptr m_valueLabel;
                Slider::Ptr m_slider;

tgui::MyTguiSlider::MyTguiSlider(const sf::String& name, const Layout width)
                m_valueLabel = Label::create("100.00");
                m_slider = Slider::create();
                m_nameLabel = Label::create(name);             
                getRenderer()->setBackgroundColor({ 100, 100, 60 });

                m_slider->setSize("95%", 10);
                m_slider->setPosition("&.w/2 - w/2", "nameLabel.bottom + h");
                add(m_slider, "slider");               
                m_valueLabel->setPosition("slider.right - width", " - height");
                add(m_valueLabel, "valueLabel");               

                m_nameLabel->setMaximumTextWidth(m_slider->getSize().x - m_valueLabel->getSize().x - 10);
                m_nameLabel->setPosition("slider.left", 0);
                add(m_nameLabel, "nameLabel");

                setSize(width, "slider.bottom + 10");

Wow! I don’t have to implement it myself. I just can use tgui::Texture and tgui::Sprite! Thank you very much for your library! It is very useful to me. I am very grateful to you.

Hi Texus! Could you tell me how you implemented the "Middle" parameter on themes syntax? How do you scale given rect of texture and remain unchanged other parts?

Help requests / Re: Adding signals to derived widgets
« on: 28 December 2019, 15:37:14 »
It worked! Thanks!

Help requests / Adding signals to derived widgets
« on: 28 December 2019, 13:08:52 »
Hello! I made class inherited from tgui::Group, which contains some other widgets. Is it possible to add new signal like "GropWidgetPressed" so I could use it like this:
myGroupWidget.connect("GropWidgetPressed", [](){});

Help requests / Re: Increasing scroll sensitivity
« on: 15 June 2019, 13:37:32 »

Help requests / Increasing scroll sensitivity
« on: 14 June 2019, 06:25:21 »
Hi! I could not find any way to increase scroll sensitivity of ScrollablePanel. It's very inconvenient to scroll to the end of the content of ScrollablePanel with low contentOffset, when it has wide content height

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 15:10:07 »
Ok, thank you!

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 14:11:02 »
So basically call gui.handleEvent for every event except for the space key press event.
how can I do that?
if(event.type == Event::KeyPressed && event.key.code == Keyboard::Space)
/* handle other events */

like this?

Help requests / unfocusing widgets
« on: 24 May 2019, 11:26:24 »
auto button = tgui::Button::create();
button->connect("pressed", [](){std::cout<<"button pressed" << endl;});

/* --- */

sf::Event event;
while (window->isOpen())
        while (window->pollEvent(event))
                /* --- */
                if (event->type == Event::KeyPressed)
                        switch (event->key.code)
                        case Keyboard::Space:
                                cout<< "space key pressed"<<endl;
                                /* --- */

                        /* --- */

if you press the button and then the space key, you will see:
button pressed
button pressed
space key pressed

I use many buttons and i have another function bind to the space key. I have to unfocus widget every time i pressed it. Is there any option to disable auto focusing last pressed widget?

Pages: [1] 2