Main Menu

Table

Started by AlexxanderX, 11 December 2015, 15:23:23

AlexxanderX

Yes, there should be some calculations when the font or characters size is changed.

I don't really remember why I have chosen BoxLayout instead of VerticalLayout, but I think because I entirely rewrite the updateWidgetPositions(), so it's no more a legit VerticalLayout, but something else.

Well, need to think on this...

Yes, I never thought of the function returning nullptr.

I created the class TableItem for alignment of the widget. If you think would be easier to manage the alignment of every item of row in TableRow then go ahead. I already implemented some basic code for the events but don't work very well so I don't added in the repository.

texus

I think it would be best if you wrote the code to recalculate the positions and sizes of everything because I don't know yet what all variables do. Actually there probably shouldn't be a new function, updateWidgetPositions should just be extended to also set the sizes of the rows instead of only the positions. And then setFont should just call updateWidgetPositions at the end and the problem with manually having to call setFont will be gone as well.

It is a good point about it no longer being a VerticalLayout. I didn't know that VerticalLayout only contained an updateWidgetPositions function, I though it contained more.

I will take care of the setTextColor and setNormalTextColor and I will have a look at the TableItem and the events (tomorrow).
I will also change the insert function so that it will create a TableRow and insert the widget in it when you call insert with a widget other than TableRow.

texus

Should setTextColor and setNormalTextColor actually do something to the existing labels? Because if the user has created some labels with a custom color then they would get changed as well. It might be better to just say that these functions set the color of all future labels and thus doesn't affect the ones that already exist.

texus

You can find my changes here: https://bitbucket.org/texus/tguitable
I have added a few things, but I also seem to have broken a few things.

texus

I fixed the remaining problems, you should pull my version and see if there is still something missing or not.

AlexxanderX

Sorry for late response. I will try it, but Monday, after all the feast past.

texus

The next tgui release is planned in February, so there's no rush :)

texus

Did you already found some time to look at my version?

AlexxanderX

So I made time to finish the table. Why would you want to combine the size function with the position function? I want to say that updateWidgetPosition() is pretty frequently called and would be useless, only if somehow check if the size changed. What I need to resolve? I will also add comments in order to explain what I do.

texus

The updateWidgetPosition will only be called when widgets are changed, which isn't that frequent. I only care about performance when something is called almost every frame, but this function is only called a lot while creating the table (while adding the rows). The setPosition and setSize functions of widgets will become very light operations in the near future so the function won't be that heavy.

The Table class on my bitbucket looks finished at first sight. So you don't really have to resolve anything unless you find things that are still missing. It juststill has to be extensively tested.

Zetal

#35
Quote from: texus on 15 January 2016, 13:49:38
The updateWidgetPosition will only be called when widgets are changed, which isn't that frequent. I only care about performance when something is called almost every frame, but this function is only called a lot while creating the table (while adding the rows). The setPosition and setSize functions of widgets will become very light operations in the near future so the function won't be that heavy.

The Table class on my bitbucket looks finished at first sight. So you don't really have to resolve anything unless you find things that are still missing. It juststill has to be extensively tested.

That BitBucket link isn't accessible for me, and I'm interested in using this Table class. Would it be possible for me to have access to these classes to save me the time remaking it? Thanks!

Edit: Nevermind! I found that this was "reimplemented" as a ListView in this commit: https://github.com/texus/TGUI/commit/54e72fbdcf038bb9f614ffb1219074c6221ac8d4