GUI Builder

Started by rbenn674, 06 December 2022, 21:06:39

rbenn674

This is a really helpful and useful tool.  It would be very beneficial to add a "Control Z" or undo / redo button. Also, draggable widgets in the layer list to move them from group to group would be helpful. Maybe I can help with this in time.

texus

I agree that it would be very useful, but it is more challenging to implement than you might think at first sight.

One positive thing about implementing ctrl+Z is that not everything has to be supported initially: an early implementation might only undo some things while some other actions and edge cases can be implemented later. A partial implementation is not ideal, but it is still better than not being able to undo at all.

I currently have some other tasks that I want to get done first, so I won't be attempting to implement this myself soon. Help is always welcome, but if you or someone else doesn't contribute it then eventually I will add this myself.

rbenn674

I agree it will be a fair challenge. It may require rewriting some other parts of the code in order to "log" each action in parts. But just like you mentioned a partial functionality allowing the undo of a single deletion or moved object would be great.

Lorekp

I'd love to be able to automatically convert sizes of widgets to realtive ones(sizes)! Would also probably be pretty easy to implement and help me a lot.

texus

Implementing it might not be that hard, but I'm not sure how useful it is for any non-trivial forms.
There would be many situations where one or two widgets do need a fixed value, e.g. a sidebar panel that has a fixed width (while having a relative height and relative position).

An issue with just making everything relative is that the text size won't automatically scale, so the offset between a label and an edit box below it would change and they could start overlapping when going too small. The text in the edit box itself will also no longer look correct when you just start changing the height of the edit box based on the window height.

While I don't know what the best way is to make a responsible form, I don't really believe that just making all positions and sizes relative is a good method unless you only display a few buttons. Changing the view of the gui might be more useful in some cases where you need simple scaling. That being said, I'm not against adding some button to the gui builder to make everything relative in the currently opened form.

Lorekp

I'd just make a button next to every value that automatically uses the forms width/heigth to calulate the relative percentage.

texus

That was the alternative approach that I was also thinking about. I ignored that option earlier because I thought you wanted some quick way to convert an entire form.

The latest TGUI 1.0-dev build now has such a button next to the position and size values.