Recent Posts

Pages: [1] 2 3 ... 10
1
Help requests / Re: ToolTip inside ScrollablePanel
« Last post by glagan on 14 July 2018, 13:06:53 »
I knew it would be complicated since you need to know the parent height :(
I actually know when the tooltip will not be visible, so the code you wrote actually works and it's fine for me, thanks for the answers :)
I replaced - 20 with
Code: [Select]
- bindHeight(tooltip) and it works.
2
Help requests / Re: ToolTip inside ScrollablePanel
« Last post by texus on 14 July 2018, 00:30:27 »
The tooltip gets positioned in this part of code, which has no idea about the original widget to which the tooltip is connected (and it thus can't know that the widget is at the bottom).
The position is determined by 3 parts: the mouse position, a constant offset retrieved via ToolTip::getDistanceToMouse() and the position of the tooltip widget which is normally always (0,0). The first one can't be changed and the second one applies to all tooltips, so only the third one can be used to alter the position without changing the current design. If you know the widget is at the bottom then you can create the tooltip like this: (code hasn't been tested)
auto tooltip = tgui::Label::create("Tooltip text");
tooltip->setPosition(0, -tgui::ToolTip::getDistanceToMouse().y - 20);
widget->setTooltip(tooltip);

But that is just a hack, you can't even rely on the label height (unless you call tooltip->setFont yourself first) because it will only receive a font when it becomes visible.
The only way to do it properly is to change the current design and rewrite how tooltips are created.
3
Help requests / Re: ToolTip inside ScrollablePanel
« Last post by glagan on 13 July 2018, 23:56:10 »
Thanks, it works now :)
The tooltip did show up, but you had to hover the old position of the element (without scroll) to show it.

One last problem is that tooltips are not really visible when you hover an element at the bottom of the window, the tooltip is "out" of the window.
A simple trick would be to display the tooltip above the mouse instead of below. I tried to do it but I still don't really understand how everything works ^^'
4
Help requests / Re: ToolTip inside ScrollablePanel
« Last post by texus on 13 July 2018, 16:41:49 »
I couldn't actually reproduce what you said, when I tested the tooltip in a ScrollablePanel it didn't even show up when the panel was scrolled.
I've fixed this behavior, you should check if your problem is solved when you download the latest version from github (https://github.com/texus/TGUI).
5
Help requests / ToolTip inside ScrollablePanel
« Last post by glagan on 13 July 2018, 15:41:29 »
Hi, when you add ToolTips to elements in a ScrollablePanel, the tooltip stay fixed, after scrolling the tooltip is at the same place.

Thanks.
6
Help requests / Re: scrollablepanel & combobox (0.8)
« Last post by roccio on 25 June 2018, 15:48:41 »
Ok, thank you, your fix works fine.
7
Help requests / Re: Setting just one size coordinate for Panel
« Last post by tapir on 23 June 2018, 16:01:12 »
Thanks a million texus. You're right I didn't realize I called getSize() on the panel before it was added to the gui.
Iterating through the widgets sounds like a good solution for what I want.
8
Help requests / Re: scrollablepanel & combobox (0.8)
« Last post by texus on 22 June 2018, 18:59:20 »
This was a bug, it has been fixed in the version that you can download from github.
It's an interesting bug, it can't be solved easily and I'm going to have to fix this properly at some point, but for now I added in a small hack to make it work.
9
Help requests / Re: Setting just one size coordinate for Panel
« Last post by texus on 22 June 2018, 18:30:35 »
Panel is initialized with size {"100%, "100%"}, which will only be (0,0) if the parent of the panel has size (0,0).
My guess is that you haven't added the panel to its parent yet (by doing something like "gui.add(panel)") when you are calling getSize. If you don't call setSize then the panel will automatically change its size when you add it to its parent (since it detects a parent size change at that moment). When you call setSize(0,0) then you are giving it a fixed size instead of binding its parent size which is why it will remain (0,0) even after adding it to its parent.

Panels can't auto-size based on its content, you can't have its size depend on the widgets inside it, you can only make it depend on its parent (e.g. panel->setSize({50, "100%"}) will set a fixed width and variable height).

You can calculate the size needed by the panel by looping over all its widgets (accessible with panel->getWidgets()) and calculating the maximum value of "widget->getPosition() + widget->getFullSize()". (I use that calculation myself in ScrollbablePanel but just realized that this may be incorrect and you probably also have to add widget->getWidgetOffset() to be fully correct for all types of widgets). You would have to keep track of when you add/remove widgets to the panel yourself and update the size of the panel manually.
10
Help requests / scrollablepanel & combobox (0.8)
« Last post by roccio on 22 June 2018, 11:35:58 »
Hello,
I'm using v0.8 with visual studio 2017 and I have a problem.

I have a scrollable panel and inside this I have a combobox. The problem is when I scroll the panel and then try to  open the combobox for selecting a value. The list is scrolled down, and is displayed in incorrect position, even outside the panel (so that is impossible to see).

Any thought?

Thank you
Pages: [1] 2 3 ... 10