Recent Posts

Pages: [1] 2 3 ... 10
1
Help requests / Re: Undefined reference to .connect
« Last post by eugustus on 31 December 2020, 15:06:27 »
Are you including TGUI.hpp or are you including Signal.hpp directly? If you don't include TGUI.hpp then you must also include SignalImpl.hpp

It's good to KNOW!!
2
Help requests / Re: How to use file form generated by GUI_BUILDER?
« Last post by eugustus on 29 December 2020, 19:27:24 »
Sorry it's OK. I had a typo in the code ...

Thank you for your help!
3
Help requests / Re: How to use file form generated by GUI_BUILDER?
« Last post by eugustus on 29 December 2020, 19:22:10 »
So, the generated form looks like this:

Panel."panel-quick" {
    Size = (110, 400);

    Renderer {
        backgroundcolor = #7F7F7F;
        bordercolor = black;
        font = "/home/denis/projects/test-sfml/data/ubuntu_font/Ubuntu-C.ttf";
        padding = (2, 2, 2, 2);
        texturebackground = None;
    }
}


Loading:

m_tgui->loadWidgetsFromFile("/home/denis/projects/test-sfml/data/themes/test.txt", true);

I'm getting this error:

tgui/src/TGUI/Container.cpp:218: virtual void tgui::Container::add(const Ptr&, const sf::String&): Assertion `widgetPtr != nullptr' failed.

:)



         
         
4
Help requests / Re: How to use file form generated by GUI_BUILDER?
« Last post by texus on 29 December 2020, 18:58:24 »
You can call gui.loadWidgetsFromFile(filename).
You can also call the function on a Container widget instead of on the Gui, in case you want the form to be loaded inside a child window.

The only place where this is currently mentioned is the tgui homepage. It doesn't belong there, but I placed it there to have it at least mentioned somewhere :)
5
Help requests / How to use file form generated by GUI_BUILDER?
« Last post by eugustus on 29 December 2020, 18:55:21 »
Hi. I can't find anywhere how to use the form generated by gui_builder.
Is there a guide, an example or maybe someone can tell me, how I can use the generated code?
Thank you.

P.S. I use TGUI version 0.8.8
6
Yes, I meant mouseDownEvent instead of event.

The getWidgetBelowMouseCursor was actually added to 0.8 as well, but its currently only in the 0.8 branch on github (which will become 0.8.9).
7
Hey Texus,

I guess you meant :
mouseDownEvent.type = sf::Event::MouseButtonPressed;

thanks you very much for your help, it works like a charm.(except I can't use this wonderful 0-9 function and had to get another way to know if my cursor was on the widget ;) )
8
MouseReleased in ListBox wasn't made for this. It was added so that you could know when selecting an item end (since you can hold down the mouse button and move to select a different item).

Dragging an object on top of another is not really something supported in TGUI. You can drag things (e.g. the thumb of a slider), but until you drop it all events to other widgets are ignored. Since you need special code for dragging anyway, you might as well add some extra code to handle dropping it on the right item. I would just add the following code before the gui.handleEvent call to simulate a mouse down event before processing the mouse release:
if (dragging && (event.type == sf::Event::MouseButtonReleased)
 && (gui.getWidgetBelowMouseCursor({event.mouseButton.x, event.mouseButton.y}) == listBox))
{
    sf::Event mouseDownEvent = event;
    event.type = sf::Event::MouseButtonPressed;
    gui.handleEvent(mouseDownEvent);
}
9
Hello,

I'm trying to code something where you can drag an object and drop it on a listbox, and it does something depending on the item index where the object is dropped.

Problem is, the signal ListBox::MouseReleased doesn't work if the start of your click is not in the list box.

I thought maybe it needed to be focused, so I made a MouseEntered signal for the list box and bound  it to focusing this listbox, but it's still doesn't work.

If anyone has an idea, thank you for your help !
10
Thanks for reporting and providing a clear MCVE. This has now been fixed in the latest 0.9-dev version.
Pages: [1] 2 3 ... 10