Files
endorphin-tessera-gui/examples/window.endor
codex-bot 76e293d3b8
Verify Tessera GUI / verify (push) Failing after 7m25s
Add managed Window resource and native shell operations
2026-10-21 17:12:55 +08:00

27 lines
925 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class WindowActions {
window: Window
function compact(self: WindowActions, event: Event): Unit {
self.window.resize(900, 600)
}
function wide(self: WindowActions, event: Event): Unit {
self.window.resize(1120, 720)
}
}
class WindowBand: RectBlock {
function measure(self: WindowBand, mount: Mount, constraints: Constraints): MeasureResult {
return MeasureResult(constraints.maxWidth, 32)
}
}
window = ui.window()
actions = WindowActions(window)
band = WindowBand(80, 32, 0, "#237A45")
compact = Button("紧凑窗口 900 × 600")
wide = Button("宽窗口 1120 × 720")
compactConnection = compact.on("click", actions.compact)
wideConnection = wide.on("click", actions.wide)
page = Page()
page.render(Column(24, 16, TextBlock("代码与 GUI 操作同一个受管窗口对象"), band, compact, wide))
page.open(window)
window.setTitle("Endor Window")
window.resize(1120, 720)