Exercise: Lay out a form with CSS Flexbox
A possible solution is at the end of this page.
Open Exercise-ConvertToCssFlexbox.bbj from 05_CssLayouts.zip for the exercise source code.
This exercise displays a short form in a window with flow layout.
Goals:
-
Augment the
json!variable to set the CSSdisplayproperty of the window toflexto switch to a flexbox layout. -
Augment the
json!variable to set the CSSflex-directionproperty of the window tocolumn, so the controls are laid out vertically. -
Augment the
json!variable to add padding around the window and a gap between the controls. -
Note that the program uses the succinct versions of the
BBjWindow::addEditBox()methods that take only the contents of the control, and chains theBBjControl::setAttribute()method to give each edit box a label in one line of code:myName! = window!.addEditBox("Joe Blow").setAttribute("label", "Name:")
Possible solution
The starter file is Exercise-ConvertToCssFlexbox.bbj. The solution is in Exercise-ConvertToCssFlexboxComplete.bbj, and you find all files in 05_CssLayouts.zip.