2020/09/28 06:48:05
Rick B.
Can someone please provide an explanation of what the Justification and Orientation flags do exactly?  And what is the significance/difference in setting these in a Widget versus a BoxSizer?

I'm having a hard time getting the flex alignment doing anything like expected, and think my lack of understanding the above may be the issue.
2020/10/06 05:51:48
Hi Rick,
There is a documentation update about sizers: https://github.com/linux4sam/egt/blob/master/docs/src/layout.md
About your questions:
- Orientation: It's probably something that should go away from the public API. It's legacy stuff when there was only the BoxSizer class. The HorizontalBoxSizer, VerticalBoxSizer and FlexBoxSizer automatically set the orientation. If you create a FlexBoxSizer and change the orientation to vertical, it would behave as a VerticalBoxSizer.
- Justification: It's about positioning the widget within a row. If there are free space in the row, start will put all the widgets at the beginning of the row, ending at the end, middle at the middle and justify will put space between widgets. The way justification works comes from the layout library (https://github.com/linux4sam/layout).
To see how it behaves, you can use this example:

#include <egt/ui>

using namespace std;
using namespace egt;

int main(void)
    Application app;
    TopWindow top;

    FlexBoxSizer sizer(top, Justification::justify);
    Button b1(sizer, "b1", Rect(0, 0, 100, 50));
    Button b2(sizer, "b2", Rect(0, 0, 100, 50));
    Button b3(sizer, "b3", Rect(0, 0, 50, 50));
    Button b4(sizer, "b4", Rect(0, 0, 50, 50));
    Button b5(sizer, "b5", Rect(0, 0, 500, 50));


    return app.run();

2020/10/06 06:19:19
Rick B.
Thank you!  That was helpful.
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account