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

Pages: 1 [2]
Thanks for your answer, Texus.

Sorry, i was not clear enough and used "container" to be more generic, but parent of my scrollbar is actually the child window, there is no other container. The code i submit is not the exact paste of what is in my project.

Not sure i'm happy or not that this is a bug, but at least, i now know that i was trying to do the right thing. What i want to do is Having the scrollbar on the inner right of the child window, fitting the whole height of it.

i used bindHeight in order to make the scrollbar fit the height of the window, wich worked great:

scrollbar->setSize({10, bindHeight(channels)});

channels is the name of my childwindow

and bindRight to set the scrollbar inner right of the window, using an offset that is the whidth of the scrollbar (getsize did not work and would not compile, i had to use the numerical value).

scrollbar->setPosition({bindRight(channels) - 10,0});

this is the part with strange behaviour, as the scrollbar is int the good position when creating the childwindow but doing weird stuff when moving the window, like it was not using the same coords than the window itself.

scrollbar->setPosition({"100% - width", 0})

this is working great and fixed my issue.

Also, Bindright seems to want to bind the left side of the scrollbar on the right side of the window, wich position it out the window , i think that's what you're talking about with bindInnerWidth, would'nt bindRight just want to stick right side of the widget on left side of the childwindow ?

Many thanks for your fast answer, i can continue building my interface now.





I'm setting a scrollbar in a child window, i first tried with layouts, this should have been cool to


but the scrollbar is moving within the container when i move the window like it was not using relative coordinates, it just won't stay right of the window.

so i tried :

scrollbar->setPosition(sf::Vector2f(container->getSize().x - scrollbar->getSize().x, 0));

The scrollbar moves with the window as expected but stays in place when the window is resized, just like the window size is not updated.

I know it is a noob issue, but still, i can't figure how to fix it as it is my first day using TGUI. any idea ?



Help requests / Re: SFML drawing into a child window
« on: 25 May 2020, 18:59:21 »
thanks, i will try that and keep the thread updated if i have questions.


Now that i experimented the canva and successfully drawn and displayed a vertex array in the canva, i'm having hard time to pass the vertex array by reference from function to another function.

What i want to do is have the vertex array in a different place. I know it's more a general c++ question, i can pass some values by reference but have no idea how to pass the vertex.

 here is the minimal code :

void test_draw(sf::RenderTarget& target)
    sf::Vertex vertex;
    sf::VertexArray test(sf::Quads, 4);

    test[0].position = sf::Vector2f(0, 0);
    test[1].position = sf::Vector2f(50, 0);
    test[2].position = sf::Vector2f(50, 70);
    test[3].position = sf::Vector2f(0, 70);

    // this is where is the trouble ... how do i say Test is the target ? ... i can do it with an int but
    // target = test; will not work

then i will have to retrieve the target in the other function:

void channels_window(sf::RenderWindow &window, tgui::Gui& gui) // this will be called in the main
sf::RenderTarget *target; // not sure if i can declare the render target like this
//it won't let me declare something else than a pointer

auto canva= tgui::Canvas::create();

//this is where i a missing something, how do i retrieve the vertex
testdraw(target); //???
canva->draw(target); // if the target is retrieved, it should draw fine.


this is a bit messy but i removed a lot of things in the code, just to go to essentials. I know that's a real noob question and that i should go back to my C++ class but, i don't have one and i'm self learning. Books and internet classes don't give all the answers.

Thanks by advance


Help requests / SFML drawing into a child window
« on: 25 May 2020, 18:31:07 »

I'm new to TGUI and kind of rookie in programming, so please be kind !

i'm searching how to draw some SFML stuff into a tgui child window, i understood how to create the child window widget, adding widgets to a parent widget, so i have my child window on screen. sfml graphics are ready and i can display them in sfml main window.

What i want to do is an interface with multiple windows that can dock together like magnetic links. Most of the windows will have SFML draws inside. The windows will have to be inside the main sfml window. Any clue with that ? or Tgui child windows can only contain tgui widgets ? I like how i can configure Child windows with TGUI so i would prefer to be able to draw inside than create multiple ugly sfml windows.

Thanks for your answers



Pages: 1 [2]