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 ... 105
1
I have patched the issue. There was a typo that caused the Unfocused handler to be connected to Focused callbacks instead of Unfocused callbacks.

There isn't a new nuget package yet, but you can download the up-to-date nightly build by clicking the following download link: TGUI.Net-0.8-dev-64bit.zip

2
Help requests / Re: Connect not available
« on: 31 July 2020, 08:24:20 »
The connect function has been removed in TGUI 0.9-dev.
There are no tutorials for this version yet, the only indication that the connection function was removed is in the changelog:
Quote
- Rewrote signal system again, b->connect("Pressed",...) is now b->onPress(...)

So you have to use those onXxx members now.

If you are in a situation where you only have the string that you want to connect (e.g. the "pressed" string was read from a text file) and you need to connect dynamically and can't use those onXxx members then you can use widget->getSignal(signalName).connect(...).

3
So the problem is that only the selected panel is part of the container, right?
I think all panels should be added to the container, you should just use setVisible to show/hide to right one instead of removing and adding from the container.

4
Quote
I think it would be good to provide method for changing height of Tabs in some form
I agree, there should be some way to customize the height. A setTabsHeight function could be added.

Quote
In code above I just use getTabs function, but I removed it in PR because I don't see any sense to provide full access to private member in library. Or am I wrong and such function is OK?
I'm ok with having some internal classes exposed. Ideally, all functionality should be in the outer class so that nobody would ever need to access the internal classes directly, but in cases like this, having access to the Tabs class would allow people to do some extra things that wouldn't be possible with only the functions in TabContainer. That being said, such a function should only exist to provide internal access for use cases that someone else might think about in the future, not for existing use cases. Being able to do something via getTabs() is not an excuse to not provide the functionality in TabContainer. So a function to set the height of the tabs should still be added, even if getTabs() is added as well.

In the documentation of the getTabs function you say that it returns the internal Tabs object. The word "internal" should definitely appear in the description to indicate that you are typically not supposed to use the function. I used to mark such functions as "@internal" as well, but that removes them from the documentation by default, so now I try to only do that if I really don't expect a user to ever call the function.

Quote
it's needed for case if user forbid selection changing in onSelectionChanging handler
I didn't look at the code closely enough to realize that you added the ability to abort the change. I should probably do something similar for closing ChildWindow.

Some other minor remarks:
- There are still some functions starting with capital letters (Select and Count).
- Documentation should only start with "//!<" if it is placed next to the code. If above the code, it should just be "///".
- Count() should probably be renamed to getPanelCount() for consistency with other widgets.

About the coding style, I usually don't write braces around bodies in if statements when they only contain a single line of code. For example
Code: [Select]
if (idx == 0)
{
    Select(m_panels.size() - 1);
}
else
{
    Select(idx - 1);
}
could be written more compactly as
Code: [Select]
if (idx == 0)
    Select(m_panels.size() - 1);
else
    Select(idx - 1);

I don't care enough about it to remove them when cleaning up the code (I kept them in SpinControl as well), but I do see them as superfluous (unless they are added to increase readability such as with nested for loops or when the body of the if statement is split over multiple lines).

5
I would call it TabContainer.
- The name PanelHolder doesn't indicate that there are tabs.
- Notebook widget is hopeless to search for due to Jupyter Notebook.
- I didn't have any better ideas myself, TabbedPanel doesn't sound good.
Googling for TabContainer does provide some results on what it is, so even if people don't immediately know what it does from the name they will easily be able to find a description.

The code mostly looks fine. A few remarks:
- Why double the height of the tab in the constructor?
- addPanelAt should be called insertPanel for consistency with other widgets
- Is "m_tabs->select(m_index);" in "m_tabs->onTabSelect" in tgPanelHolder constructor needed? Wouldn't it already be selected before this callback function is even called (and changed a second time in the Select function)?
- Perhaps you should only call "m_tabs->select(index);" in the Select function when the index in the tab is different (i.e. when the user called select himself). Right now you have something that looks like a recursion: Select calls m_tabs->select which triggers onTabSelect in which you call Select again. This works because the Tabs widget doesn't send another callback when the index didn't change, but it might be better to not rely on such internal behavior of Tabs (even if the behavior is never going to change).
- The documentation (comment above class) should probably mention that if you want just the tabs without the panels then the Tabs widget can be used. Similarly, the documentation for the existing Tabs widget should get an extra note that it doesn't contain any panels but if people want a panel directly below their tabs then they can use the TabContainer widget.

6
Not really, I don't even have a mac :)
You can probably just delete the .framework file (if you can find the folder where it gets installed to). Although I don't think the framework would be causing conflicts.

Have a look at https://stackoverflow.com/a/61536481 for a random recent guide on installing sfml. Maybe you still have some wrong directories in the library path?

7
Is there a libsfml-window.2.5.dylib file in /usr/local/opt/sfml/lib/?
You could try reinstalling sfml with homebrew, maybe something broke when uninstalling the other version?

8
You should remove the one you installed yourself. They are likely identical versions and it won't matter which one is removed, but the homebrew TGUI package is build with the homebrew SFML version so you can be certain that those are compatible.

9
It seems like you have 2 SFML versions installed on your computer (probably one installed manually and another installed via homebrew, possibly while installing tgui). One is installed in /usr/local/lib/ and the other is installed in /usr/local/opt/sfml/. The TGUI homebrew package was build with one of those (the one from homebrew) and will require exactly that one SFML version in order to work, so you have to uninstall the other one.

10
Feature requests / Re: SpinCtrl
« on: 19 July 2020, 14:38:14 »
I've implemented saving and loading. Some fixes unrelated to SpinControl were needed to make it work.
The mouse cursor change has also been added by now.

11
TGUI 0.9-dev will now change the mouse cursor when hovering over the borders of a child window (if setResizable(true) was called).
The code was a lot more complicated that I originally thought so there is no chance at all that this would be backported to 0.8.

More information about the final design can be found in the announcement I made in Discord:
Quote
TGUI 0.9-dev now supports changing the mouse cursor.
There are 3 ways the mouse cursors are used:

1) Resize cursors will automatically be shown when hovering over the borders of a resizable child window. The default invisible border width has also been increased from 5 to 10 pixels. Those changes make resizing a child window a lot easier.

2) A setMouseCursor function has been added to the Widget class. The requested mouse cursor will be shown when the mouse hovers over the widget. The following line would cause the I-beam cursor to be visible when hovering over an edit box:
editBox->setMouseCursor(tgui::Cursor::Type::Text);

3) You can set a mouse cursor that will be used anywhere on the window and which overrides the cursor from the previous two methods. To do this, call the setOverrideMouseCursor on the Gui object. Call the restoreOverrideMouseCursor() function later to let the gui change the cursor automatically again based on the widget below the mouse.

Styling the cursors:
System cursors are used by default. Bitmaps are also supported by using the static tgui::Cursor::setStyle(Type type, const std::uint8_t* pixels, Vector2u size, Vector2u hotspot) method.

Changes to building TGUI:
- Minimum SFML version was increased from 2.3.2 to 2.5.0
- TGUI will now links to X11 on Linux to work around a limitation in SFML

12
Feature requests / Re: SpinCtrl
« on: 15 July 2020, 19:57:23 »
The code has been merged. Thanks again for contributing this.

I noticed that there is still a warning left, but I will fix this myself. Once I'm done with what I'm working on (ability to change mouse cursors plus some code reorganization), I'm going to have a detailed look at the code you added and make some nitpick changes anyway.

13
Feature requests / Re: SpinCtrl
« on: 14 July 2020, 19:31:51 »
Does it really matter that if the user typed "123text", we keep the "123" instead of resetting the value? I don't think anyone is even going to notice the behavior (because you typically do type actual digits in it). And I would kind of consider it a feature that it keeps the value I typed if I accidentally hit another button together with the enter key :).
Maybe the edit box should have Validator::Float set, that way you can't even type text or have multiple commas.

The compile error is coming from line 45 because you have a generic lambda. GCC 5 doesn't seem to like it that you call a member function from inside a generic lambda. You should change "auto" to "float" there. I personally never use auto for simple integers and floats, usually it doesn't matter but in this particular case you can't use auto (at least not when keeping the older compilers supported).
There are also a few warnings about you reusing the "value" variable name multiple times in the same function (line 45 and 69 reuse the name declared at line 33).

14
It's probably not going to be finished this weekend. The implementation is a bit more complicated than expected (e.g. the mouse cursor is tied to a window and therefore to a specific Gui object). Because of this I decided to add the cursor code together with a larger change, so it will take a bit longer.

15
Feature requests / Re: SpinCtrl
« on: 10 July 2020, 23:25:12 »
Thanks a lot. I'm sure several people will find this class useful.

The only think that I miss in the class is the setSize function. If setSize is called on the SpinCtrl, the spin button should probably keep its ratio (so if height is doubled then width is doubled too) and the edit box would take up all the remaining width.

I'm not a big fan of having a createIntegerSpinCtrl function, I would prefer that all widgets would be created via the 'create' function, but I don't see many alternatives either. Maybe instead of choosing Int vs Float, there should be an amount of digits behind the comma? If set to 0, only ints get accepted, if set to 2 then "x", "x.a" or "x.ab" would be accepted but "x.abc" would be rounded. The default could be -1 which allows any float input.
Maybe the TextChanged event could also be replaced by ReturnOrUnfocused, so that you can still e.g. copy "x.abc" into the edit field and it would only be rounded and accepted when pressing enter or unfocusing the edit box?
Ultimately I'll leave this decision up to you, it's just some idea to think about. I would merge the class no matter how the int vs float is solved.

Instead of using std::stof and exceptions, I think String::toFloat should be used. Whether we should depend on the locale to parse numbers is arguable, but for now it would probably be best to rely on the code always behaving the same on every pc. I recently discovered that std::stof does depend on the locale and may turn "1.5" into "1" for some people, which is why I stopped using std::stof in the String class.

Finally some nitpicks. Maybe you would have already made some of these changes when cleaning up the code, but here are a couple of minor things that don't correspond to the rest of TGUI code:
- You can use SignalFloat instead of SignalTyped<float>
- SetValue shouldn't have capital S
- Lowercase 'f' instead of 'F' is used in TGUI behind floating point numbers
- If a value isn't going to be changed, it can be a 'const' variable (e.g. curValue)

Pages: [1] 2 3 ... 105