• AVR Freaks

Question on Flex layout Justification and Orientation flags

Author
Rick B.
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2020/09/01 08:12:04
  • Location: 0
  • Status: offline
2020/09/28 06:48:05 (permalink)
0

Question on Flex layout Justification and Orientation flags

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.
#1

2 Replies Related Threads

    ldesroches
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2019/08/04 23:43:09
    • Location: 0
    • Status: offline
    Re: Question on Flex layout Justification and Orientation flags 2020/10/06 05:51:48 (permalink)
    5 (1)
    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));

        top.show();

        return app.run();
    }

     
    Regards
     
    Ludovic
    #2
    Rick B.
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2020/09/01 08:12:04
    • Location: 0
    • Status: offline
    Re: Question on Flex layout Justification and Orientation flags 2020/10/06 06:19:19 (permalink)
    0
    Thank you!  That was helpful.
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5