CSBS Engine Example
Example code for a GUI, by using the CSBS Engine for data binding and behaviour.
// Assuming the data model: (String myString) // This is global for all String's. var font-size: FontSize = 16px // Wrap all Strings in wrappers. for String.wrapper { // These are per String wrapper. var font-italic: FontItalic = normal var font-weight: FontWeight = normal window: { width: 400 height: 300 title: "String Editor" } layout: border // Use the 'before' pseudo-child as toolbar. for this.childs.before { layout-slot: north layout: qk-toolbar content: <\> <checkbox qk-label="Italic" value=($font-italic bind binary(normal, italic))> <checkbox qk-label="Weight" value=($font-weight bind binary(normal, strong))> <spinner qk-label="Size" value=($font-size bind numrange(10, 18, 2))> </> } } // The String is a child of its wrapper, // so this displays it as text in the window. for String { display: root.text layout-slot: center qk-editable: text font: { family: 'Arial' italic: $font-italic weight: $font-weight size: $font-size } }
















