sirinsidiator / ESO-LibAddonMenu

http://www.esoui.com/downloads/info7-LibAddonMenu.html
Artistic License 2.0
41 stars 20 forks source link

Alignment and side-by-side editboxes #124

Closed sburkett closed 2 years ago

sburkett commented 3 years ago

Not sure if this is an issue, a suggestion, or a plea for help :) I did some searching but came up empty, so apologies if this is obvious and I've missed something right in front of me.

What I'm trying to do is something like this:

image

So, basically, a series of side-by-side editboxes, with 2 column headers at the top.

First thing I'd like to try and do is decrease that vertical gap between each set of 2 editboxes. Seems awfully large, and just not sure how to do that. If each of the fields were set to full width, the gap is much shorter. Only when they are all set to half does this appear.

Ideally, I'd like the fields to be aligned with the column headers, but they appear offset as you can see. I see where this is a native SetHorizontalAlignment() method in ESO, but trying that manually didn't seem to work.

Is there some way to align those editboxes to the left rather than the right?

Any thoughts?

Baertram commented 3 years ago

The gap exists because you are using the width="half" tag at the editboxes. With width="half" the gap always exists because of the name shown at the top left edge of the edit control. Afaik this was done to be able to show the name/title for the total of 50% of the lam panel's width. Else the title/name would be abbreviated like "Column ..." very early if it does not fit into the space between the left lam panel border and the editbox (50% = "half" of the lam panel). Maybe it's even a technical issue with the label used there. So with the given lam editbox you cannot change this gap afaik ,and you cannot align them to the left, no.

The conrols use anchors (to eah other, to the lam panel, to the gui elements/other controls/parent controls etc.). If you want to change the anchors you need to use control:ClearAnchors() at first and after that you can use other control functions that change the alignment + reapply SetAnchor() to anchor them properly to other controls again.

You could build your own anchored editboxes like you want them to be within the LAM custom control widget. It got a created funciton callback and a minHeight attribute to preset the custom control's height. You are able to add controls to that custom contol and anchor them the way you want them to appear. Maybe there even is a way to re-use the LAM editbox controls there.

Baertram commented 3 years ago

Oh and maybe your usecase could be handled differently? Have a look at the library LibShifterBox. It got 2 list controls where you are able to move items from left to right. Maybe it helps with your editbox list somehow? You can add this to a LAM customcontrol e.g.

sburkett commented 3 years ago

There doesn't seem to be much documentation on the newer custom control feature. Is the custom control basically a "container" for other controls? If so, how do you place other controls in it? Is it just a matter of using the custom anchoring functions to put everything relative to this invisible/custom container?

Baertram commented 3 years ago

Yep, exactly. It's just a container control where you anchor your other controls into, just like you need them. Could look like this e.g https://i.imgur.com/nhXL1la.png Yellow rectangle: LAM custom control Orange rectangle: LibShifterBox control added to the custom control via the "createFunc" callback