COMPONENT-widget-properties.sleela
examples/gui/COMPONENT-widget-properties.sleela · 24 line(s) · sleela
#sleela 2.5
class WidgetProperties {
int main() {
SLUserInterface ui = new SLUserInterface(); ui.configure("com.mearvk.examples.WidgetProperties");
if (!ui.open()) { return 1; }
SLTheme theme = new SLTheme(); theme.defaultTheme();
SLWindow win = ui.openWindow("Common Widget Properties", 620, 440, theme.handle());
SLWidget root = win.rootWidget();
SLBox col = new SLBox(); col.vertical(root, 12); col.setMarginAll(18);
SLLabel label = new SLLabel(); label.createIn(col, "Aligned start; expands horizontally.");
label.setAlign(SLWidget.ALIGN_START, SLWidget.ALIGN_CENTER);
label.setExpand(true, false); label.setSizeRequest(280, 36);
SLButton disabled = new SLButton(); disabled.createIn(col, "Disabled action");
disabled.setSensitive(false);
SLButton hidden = new SLButton(); hidden.createIn(col, "Hidden until shown");
hidden.setVisible(false);
SLLabel value = new SLLabel(); value.createIn(col, "Margins and spacing are managed by parent layout.");
value.setMargin(8, 12, 8, 12);
SLButton show = new SLButton(); show.createIn(col, "Show hidden control");
// Visibility can be toggled by retaining the widget reference and calling setVisible(true).
win.show(); return ui.run();
}
}