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 ... 90
1
General Discussion / Re: gui-builder form file decoding
« on: 14 April 2019, 11:39:37 »
You can use the get function which takes the name of the widget as parameter:
tgui::Widget::Ptr widget = gui.get("name"); // Without template you get the Widget base class (for when you don't need functions specific to the widget type)
tgui::Button::Ptr button = gui.get<tgui::Button>("name"); // With template you can get an object of the right type

2
Help requests / Re: TextBox, Button and Functions.
« on: 13 April 2019, 19:44:28 »
The merhaba function takes 2 parameter, neither of which the Button should provide (i.e. the last parameter isn't a string that should contain the caption of the button), so you have to provide both parameters to the connect function:
button->connect("pressed", &merhaba, std::ref(window), i);

The "i" value will however be copied, so the merhaba function will always be called with the same value.
If you want to get the value of the edit box at the moment you press the button then you should pass "yazialani" instead of "i" to the connect function (and change merhaba to take a tgui::EditBox::Ptr as second parameter) and put the "int i = std::atoi(yazialani->getText().toAnsiString().c_str());" at the start of the merhaba function.

3
Feature requests / Re: Theme constructor
« on: 12 April 2019, 18:36:54 »
I'm the sole developer. Some people have contributed some pieces of code but most comes from just me.

Quote
we could prevent users to tamper with the theme
Personally I don't think we should prevent people from tampering with resources if they want to change things. But loading from memory can of course have its use cases other than preventing tampering so it might still a useful feature.

One problem with loading from memory is how to handle external resources. If you just want to load the theme file from memory and let the images still be loaded from files then it isn't difficult but you probably want textures to be loaded from memory as well. I'm not sure how that should be done.

Technically it is already possible with tgui to load themes without using filenames, but that is probably too much work to be useful. You could make a class that inherits from BaseThemeLoader (like the DefaultThemeLoader does) and call the static Theme::setThemeLoader function to change the loader. Then the THEME_BLACK could be defined as the string "1000" and the custom theme loader would implement a way to load the right theme based on that id.
But the way you load things from memory is probably too specific to your code to be used by others, otherwise someone would have to write it once and it could be shipped with TGUI as alternative to the DefaultThemeLoader.

4
General Discussion / Re: gui-builder form file decoding
« on: 12 April 2019, 18:21:18 »
The Gui class and any container widget have a loadWidgetsFromFile function where you can pass the filename (and a loadWidgetsFromStream function in case you want to load it from memory).

5
Installation help / Re: Cannot install TGUI as STATIC library
« on: 09 April 2019, 19:09:56 »
I didn't notice earlier that your last error was after the TGUI library was already build. Try disabling TGUI_BUILD_GUI_BUILDER when building TGUI. In the cmake gui uncheck the option or in the command line pass -DTGUI_BUILD_GUI_BUILDER=FALSE
This might be a problem with how the gui builder is linked.

Update:
I just tested it here and I also get these errors when TGUI_BUILD_GUI_BUILDER is on (default). I'll look into it.
Disabling the TGUI_BUILD_GUI_BUILDER fixes the issue.

Update 2:
I figured out why the gui-builder is giving these undefined reference errors.

SFML radically changed their cmake script in SFML 2.5 but in order to remain compatible with older SFML versions I added a compatibility layer. Since SFML_DIR is not defined, TGUI is using it's own way to find SFML which was apparently broken for static linking. This has now been fixed in the latest version on github.

However it turns out that if the compatibility layer isn't used (by setting SFML_DIR to /usr/local/lib/cmake/SFML/ or wherever SFML is installed), it will give undefined references to GLX functions instead. I had to manually link to GLX to build statically. This does look like an issue with SFML itself. I'll try to investigate it further in the next few days.

6
Installation help / Re: Cannot install TGUI as STATIC library
« on: 09 April 2019, 19:01:02 »
Quote
I managed to install TGUI as Dynamic Library on my Raspberry PI 386 Debian Linux.
Did you encounter any issues in doing this? It's been a few years since I tested TGUI on a Respberry Pi, so I'm interested to hear whether or not it still works without manual changes.

Quote
In the long run it creates a lot of support issues.
What kind of problems would you expect? I know it is possible to bundle the .so files with the application. It takes a lot of experimenting and you missed a file which causes it to break on newer linux systems several years later then you just need to ship that extra file. But I would consider the issues with .so files more on a short term, once you figure out how to do it properly it should continue to work on newer systems.

I've never build statically on linux so I can't help much. How did you get the other .a files? I'm not sure if they are all going to be compatible with each other when you download some random versions, but building them yourself is probably too difficult.

XRRQueryVersion and XRRGetScreenResources are part of the xrandr library. So maybe you have an incompatible libxrandr.a file or something?

I don't think this is specific to TGUI, if you reproduce it with only SFML then maybe you could ask it on their forum. Hopefully someone on the SFML forum would be able to help you further. You should try to make your own simple cmake project (which only uses SFML and not TGUI) and see if the issue still occurs, e.g. something like this:
cmake_minimum_required(VERSION 3.5)
project(CMake-test)

add_executable(Test main.cpp)

set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2 COMPONENTS graphics window system REQUIRED)
target_link_libraries(Test PRIVATE sfml-graphics)

7
Help requests / Re: button->connect member functions
« on: 24 March 2019, 17:09:47 »
The parameters for generateRW don't match, in the connect function you pass one parameter too much, the m_ebChanceStartAlive.

The generateCA line looks fine, assuming the edit boxes are declared like this in the App class:
tgui::EditBox::Ptr m_ebNumSimulationSteps;

Can you show the full errors you get on the m_buttonGenerateCA->connect call?

8
Help requests / Re: button->connect member functions
« on: 24 March 2019, 17:01:12 »
Can you show the declarations of generateRW, generateCA, instance and the other parameters you are passing?

9
Help requests / Re: Grid
« on: 14 March 2019, 20:02:53 »
VerticalLayout spreads the entire height among all widgets inside it, in this case just the Grid. So the height of the VerticalLayout (100% of parent by default) will be passed to the Grid. So you can just limit the height of the vertical layout:
verticalLayout_->setSize("100%", 150);

But if you are only putting 1 widget in VerticalLayout then you don't need it and you can just add the Grid directly to the container and call that setSize function on the grid widget.

10
Help requests / Re: Grid
« on: 14 March 2019, 19:35:02 »
All your images are wrong for that given code actually, including 5elm-5pr.jpg.
The VerticalLayout will tell the grid what it's size should be. When a Grid is given a size, it will rearrange the widgets to fill this space. This rearrangement was broken, which caused the weird results, but even with only one line there should be space between the widgets to fill the entire width.

6elm-5pr-without-verticallayout.jpg doesn't have any extra space between the widgets because it is auto-sizing (the size of the grid is determined by the widgets inside it, as the grid wasn't given a size).

In my opinion the result of your code should be similar to my attached screenshots. I didn't write the code that adds spaces between the widgets to fill the size though, so feel free to propose alternatives if you believe it should look different.

You can download the code with the fix in Grid on github.

11
Feature requests / Re: Resizable Child Windows/Right-Click Menu
« on: 13 March 2019, 19:51:41 »
You should show the code you are using because it isn't the same as the example you quoted.

12
Help requests / Re: ComboBox and State pattern
« on: 13 March 2019, 19:44:50 »
Using multiple Gui objects is not recommended at all, but I didn't fully understand what you meant and I was thinking the issue had to do with how events were sent.

I don't think it was possible yet to select a different item by holding the mouse in ListBox (which ComboBox uses internally) when the code was originally written like this in ComboBox. So this issue only appeared after an "unrelated" change in ListBox.

I've looked at how combo boxes work on my linux and a windows pc and they indeed only changes the value when the mouse is released. So I have updated my code to do the same. You can find the new version on github.

13
Help requests / Re: ComboBox and State pattern
« on: 12 March 2019, 18:57:58 »
Are you using a separate Gui instance for A and B states?
If so then you should instead use the same Gui for both states and just put each state in a separate Group widget. When changing state you just have to show one group and hide the other.
Otherwise you should provide some simple example code that I can test here to get a better idea of what you are doing.

14
The top example in your image would be harder to implement as it requires being able to set a different color for each item.
The bottom example can be implemented by just adding a default text. When the port becomes unavailable you just have to deselect the item, remove it from the list and set the default text.

So if it is enough for you then I'll just add a DefaultText property to ComboBox and a DefaultTextColor property to ComboBoxRenderer.

Edit: the default text was added to ComboBox (in the version that can be downloaded on github)

15
Quote
Is it possible to set a different color to specific items?
This is currently not possible.

Quote
I want to add item with grey color, which will mean that the item is not available.
Would you still want the user to be able to select the item? If not then it would be better not to include the item.

Quote
how can I hide selected item from items list?
In order to hide items from a list, just clear the list and fill it again with the items you want to show.

Quote
is there any function like tgui::EditBox::setDefaultText?
What should the function do exactly? Place some text in the ComboBox when none of its items are selected yet?

Pages: [1] 2 3 ... 90