Recent Posts

Pages: [1] 2 3 ... 10
1
Help requests / Re: ChildWindow closed event
« Last post by glagan on 15 August 2018, 21:20:11 »
Everything works now ! Thanks, seems like it was a tricky yet simple problem :)
2
Help requests / Re: ChildWindow closed event
« Last post by texus on 15 August 2018, 17:35:43 »
This turned out to be a bug in TGUI. The kind of bug that makes you wonder how it could possibly have worked on linux and in debug mode.

A ChildWindow** was basically casted to a void* which later got cast to a std::shared_ptr<ChildWindow>*. Accessing the pointer of the shared_ptr would still work because this is the first part of the shared_ptr class, but accessing the reference count would access memory that doesn't belong to the variable. My best guess as to why it works in debug mode is because the reference count part would have been NULL so that it just ignores it. In release mode it would contain garbage and crash when it tries to dereference it. That would also explain why a const reference fixed it: it wouldn't have to access the reference count in that situation.

Anyway, if you download the latest version from github then it should work.
3
Help requests / Re: ChildWindow closed event
« Last post by texus on 15 August 2018, 15:52:28 »
Alright, I managed to reproduce it with the libraries you sent.
I already figured out that it doesn't crash if the lambda parameter takes a "const tgui::ChildWindow::Ptr &" as parameter (instead of "tgui::ChildWindow::Ptr").
4
Help requests / Re: How can i use the sliders callback functions?
« Last post by Theodor on 15 August 2018, 15:43:44 »
Ok thanks
5
Help requests / Re: ChildWindow closed event
« Last post by glagan on 15 August 2018, 15:27:58 »
I uploaded the clean project (with everything fixed), TGUI and SFML : https://www.dropbox.com/s/ipddlbaxwgu3qx5/TestChildWindow.7z?dl=1
I didn't move the .dll to the bin folder of the project.
6
Help requests / Re: ChildWindow closed event
« Last post by texus on 15 August 2018, 13:19:14 »
I still have no clue on what the issue could be and I'm starting to run out of ideas on what to test.

There is only one thing remaining that I could check. Would it be possible for you to create a complete bundle of the project and dependencies? Zip all SFML, TGUI files and your project, including the libraries and dlls that you build so that I can execute the exact same thing (you don't have to move the SFML and TGUI folders into your own project, I can put them on the right place on my pc manually). If it just runs here then it must be something about your computer, but if it doesn't then I can start replacing files with working copies from my pc until it works to find out where it is going wrong.
7
Help requests / Re: How can i use all the widgets?
« Last post by texus on 15 August 2018, 13:11:35 »
I already told myself multiple times that I should make a list of event names, but I never find the time and motivation to do it. For now you can find them in the documentation under the "Public Attributes" (e.g. https://tgui.eu/documentation/0.8/classtgui_1_1Slider.html#pub-attribs for Slider).
You will find a line like this:
Code: [Select]
SignalFloat onValueChange = {"ValueChanged"}
Ignore the "onValueChange", I intend to deprecate accessing the variable in the future. The name of the signal is the one between quotes, "ValueChanged" in this case. The SignalFloat also shows that the function can take an optional float as parameter, but the exact parameters may not always be that easy to guess from the signal name. Hopefully the one line description ("Value of the slider changed. Optional parameter: new value." here) will be enough in these cases.
8
Help requests / How can i use the sliders callback functions?
« Last post by Theodor on 15 August 2018, 12:56:49 »
Hello, I want to start working with this awesome library but I don't know how to use the callback function. For example, what is the event name for when the slider updates like for the button it is "pressed"

This is the current code I have for my slider:

        auto slider = tgui::Slider::create()
   slider->setRenderer(theme.getRenderer("Slider"));
   slider->setPosition(10, 560);
   slider->setSize(200, 18);
   slider->setValue(4);
   slider->connect("OnValueChange", [&]() {std::cout << "Slider value: " << gui.get<tgui::Slider>("Slider")->getValue() << std::endl; } );
   gui.add(slider,"Slider");

But when I run it I get an exception like "the signal OnValueChange does not exist" so I wonder what is the event name called and how can I see all the events name for all the widgets?

I found the solution and it is "ValueChanged" but I found it when I looked through the source code and I'm sure there is a much better way.
9
Help requests / Re: ChildWindow closed event
« Last post by glagan on 15 August 2018, 12:45:54 »
The flag -std=c++14 is set globally for both Release and Debug mode, then I append the -g flag only in Debug mode and the -O2 and -s flags only in Release mode.
And the same for the linker, everything is set for both and then I set libtgui and sfml with '-d' only in debug mode and without '-d' in release mode, i did not make it static and i updated the .dll and rebuild the whole project each time I changed anything.

The _64 is not a 64-bit version it's just when I was trying to build with GCC-7.3.0 I used MinGW-64 and SFML and TGUI were in the same folder, so I put the _64 suffix to differentiate them.

And sorry everything wasn't set at it's real values in the .cbp project, I guess I played with it and didn't save it before sending it, here it is with good values that still don't work: https://pastebin.com/j3dqji1z
I also just tried to compile a static version but the result is the same :-/
10
Help requests / Re: ChildWindow closed event
« Last post by texus on 15 August 2018, 10:51:00 »
I didn't actually try the project yet (I am going to do so today), but I already noticed a mistake in debug mode. Are you only testing in release mode? I assumed that when you were talking about the -O2 and -g flags you were just talking about Debug/Release modes, but are you perhaps using the same mode and just messing with the flags?
In the debug settings you are linking to the static version of TGUI but to the dynamic version of SFML, they are not compatible. The '-std=c++14' option also seems lacking in debug mode. I noticed that even in release mode you use "libtgui" instead of just "tgui", but I guess that doesn't make a difference.

Are you doing anything special to build 64-bit, because mixing 32 and 64 bit could also create issues. And despite the name "MinGW-64", it still works 32-bits by default. I'm just checking since the TGUI and SFML folders end with a "_64" postfix. Although since you said you build SFML and TGUI yourself with the same compiler, it's unlikely that you would be mixing these versions.

Edit: I can't reproduce it with MinGW either (although I only tested with a different MinGW version so far). Just to double check: you did replace the dlls next to the exe after rebuilding SFML/TGUI, right?
Pages: [1] 2 3 ... 10