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

Pages: 1 2 3 [4] 5 6 ... 110
46
Help requests / Re: How to build tgui on android
« on: 03 February 2021, 18:32:26 »
What OS are you using? The commands that are given have to be run on the command line and might be slightly different on platforms other than linux.

I can't give you a better guide than what the tutorial contains, but if you get stuck on specific things or don't understand some of the instructions then I might be able to clarify that part.
The first step if just running cmake. You can use the graphical cmake interface if you prefer, "-DCMAKE_SYSTEM_NAME=Android" in the command would mean to create a CMAKE_SYSTEM_NAME property and set its value to "Android".

47
Help requests / Re: button->connect issues
« on: 31 January 2021, 14:00:28 »
Try "std::ref(gui)" instead of "gui", since your function takes a reference as parameter.

48
Help requests / Re: button->connect issues
« on: 30 January 2021, 19:51:47 »
I can't reproduce such error.
Can you post some minimal code that I can copy-paste so that I'm testing the exact same code?

49
Help requests / Re: button->connect issues
« on: 30 January 2021, 17:30:28 »
Your parameters are in the wrong order. The showPause function is declared with the window as second parameter but you are passing it as first parameter in the connect call.

50
Help requests / Re: How to use file form generated by GUI_BUILDER?
« 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 :)

51
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).

52
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:
Code: (cpp) [Select]
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);
}

53
Thanks for reporting and providing a clear MCVE. This has now been fixed in the latest 0.9-dev version.

54
Help requests / Re: Tool Tip Functionning - 1 Tooltip for X buttons
« on: 25 October 2020, 13:09:26 »
The gui builder simply doesn't support tool tips yet.

Quote
This would mean I shouldn't put it in the same file as my main gui ?
You could technically still store it in the main gui, but directly after calling xgui.loadWidgetsFromFile you would have to remove it again:
Code: (cpp) [Select]
tgui::ChildWindow::Ptr toolTipChildWindow = xgui.get<tgui::ChildWindow>("child_game_city_construction_tooltip");
xgui.remove(toolTipChildWindow);
// Use the toolTipChildWindow variable directly when calling setToolTip and setTitle.

The loadWidgetsFromFile will always add all widgets to the parent (because otherwise there would be no way to access the widget after calling loadWidgetsFromFile), so if you use a second file then you can't put a ChildWindow widget in there either. The second file would have to contain the contents of the child window (e.g. just a label) and in your c++ code you would have to create the child window yourself, give it a title and size and call childWindow->loadWidgetsFromFile("tooltip_contents_form.txt").

If the contents of the child window doesn't change too much based on the the button you are on then you can use one of the above solutions, but otherwise you might want to create everything dynamically in c++. The gui builder was intended for static forms and even tool tips were designed to be static (one tool tip for each button instead of reusing the same child window). It is possible to reuse the same child window (with a hack such as changing the contents on the the MouseEntered signal), but what you are trying to do was never considered so there is no "correct" solution for it.

55
Help requests / Re: Tool Tip Functionning - 1 Tooltip for X buttons
« on: 23 October 2020, 18:31:23 »
Some parts of the tool tip are automatically handled by TGUI and you shouldn't change them yourself:
- the position (what you pass to setPosition is added as an offset for the tool tip relative to your mouse, it isn't an absolute position like with normal widgets)
- the visibility (you should never have to call setVisible on a tooltip widget, TGUI will show and hide them automatically)
- the parent (i.e. don't call gui.add on the tooltip)

The crash originates from the fact that you have made the child window a part of xgui instead of letting the buttons handle the tool tip.
In order for widgets to show up on the screen, they need to be added to the gui (either directly or indirectly via some container widget). So when the button wants to show the tool tip, it adds it to the gui (which does practically nothing since you already did that). But when the tool tip gets hidden, the button removes the tool tip child window from the gui. So when you hover over the next button, `xgui.get<tgui::ChildWindow>("child_game_city_construction_tooltip")` will return a nullptr and the code crashes as you attempt to call setTitle on a nullptr.

The solution is to not add the child window to the gui (i.e. don't call xgui.add(childWindow) and instead store the child window pointer somewhere so that you can call `button->setToolTip(childWindow)` and `childWindow->setTitle(...)`. This solves both the crash and the wrong behavior where the child window is visible before you hover over a button.

Btw, when you get another crash, you should check the call stack in your IDE, it tells you where the crash happened. This information can save time in searching what went wrong.

56
Help requests / Re: Texture for RangeSlider
« on: 13 October 2020, 08:29:50 »
I think I finally understood what you mean. When textures are loaded, nothing extra is shown inbetween the two thumbs.
I'll try to fix this soon (in TGUI 0.9-dev).

Edit: I've already fixed the SelectedTrackColor property, it should work now even when textures are loaded. I'll look into adding a new SelectedTrackTexture property later.

Edit2: TextureSelectedTrack and TextureSelectedTrackHover properties have been added to RangeSliderRenderer.

57
Help requests / Re: Texture for RangeSlider
« on: 12 October 2020, 08:22:12 »
Quote
RangeSlider is inherited from Slider
It actually doesn't, it just contains mostly the same code.

Quote
I can not set the RangeSlider to display textures (available to Sliders)
What exactly doesn't work? Do you get an error or does is just not show the textures?

I just tried loading the black theme and using the Slider section to create the RangeSlider like below and it worked (it's not recommended to use a section of a wrong type, but it works here because they do support the same properties).
Code: (cpp) [Select]
rangeSlider->setRenderer(theme.getRenderer("Slider"));
Quote
There does not seem to be a way to load textures for the space between the two thumbs.
This indeed seems to be missing.
There are 2 ways this could be implemented though. You could have a texture that has the same size as the track and of which only a part is shows (similarly to how the front image in ProgressBar works), or you could have a small texture with the same height as the track which is stretched horizontally to fill the selected area. I guess the first one would be the better option because it can handle rounded corners on the track or other special cases.

58
Installation help / Re: Error CMake couldn't find SFML
« on: 19 September 2020, 20:05:12 »
Could it be that C:/Strawberry/c/include/freetype2 is giving a conflict with the freetype that comes with SFML?

59
Installation help / Re: Error CMake couldn't find SFML
« on: 19 September 2020, 20:01:39 »
I don't see anything wrong with those files, it says that it has freetype at T:/libraries/C++/SFML-2.5.1/extlibs/libs-msvc-universal/x86/freetype.lib

Did you download the SFML version from github?
You are setting TGUI_SHARED_LIBS to FALSE, right?
Could you send the CMakeCache.txt file from your TGUI build?
Could you send your entire SFML folder?

I'm not sure when I'll find enough time to look into this in detail, but if you send me those files then I'll try to find some explanation when I find the time.

By placing the old code back in TGUI's cmake you are changing the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH variables and the issue is only solved as a side-effect of this (those lines existed in the cmake script for building the gui builder and tests, not for finding sfml). So although it works, it isn't really the solution (it only works by accident that way).

60
Installation help / Re: Error CMake couldn't find SFML
« on: 19 September 2020, 18:48:34 »
Could you send the SFML*.cmake files to me that you have inside your build folder?

Pages: 1 2 3 [4] 5 6 ... 110