Files
endorphin-tessera-gui/examples/tab-placement.endor
codex-bot 7cd7ec2c11
Verify Tessera GUI / verify (push) Failing after 7m40s
Support stable insertion and managed tab placement
2026-10-22 11:29:14 +08:00

46 lines
1.5 KiB
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 TrackedPage: Page {
calls: Object
function moveToWindow(self: TrackedPage, window: Window): Page {
self.calls.increment()
return Page.moveToWindow(self, window)
}
function moveTab(self: TrackedPage, position: Number): Page {
self.calls.increment()
return Page.moveTab(self, position)
}
}
class Actions {
list: Column
function insert(self: Actions, event: Event): Unit {
self.list.insert(1, TextBlock("插入的新对象"))
}
}
calls = ui.state(0)
list = Column(0, 8, TextBlock("第一个子项"), TextBlock("最后一个子项"))
actions = Actions(list)
button = Button("在位置 1 插入 Block")
connection = button.on("click", actions.insert)
shared = Column(24, 16, TextBlock("拖动 Tab 重排、移入另一个窗口,或拖出独立窗口"), TextBlock("Page 方法调用次数"), ui.textOf(calls,"value"), button, list)
first = TrackedPage(calls)
first.title = "A · 共享内容"
first.render(shared)
second = TrackedPage(calls)
second.title = "B · 单独内容"
second.render(Column(24, 16, TextBlock("这是 B,Page 身份随 Tab 移动保留")))
third = TrackedPage(calls)
third.title = "C · 同一对象"
third.render(shared)
other = Window()
other.resize(720,520)
other.setTitle("Tab Target")
other.moveTo(1700,80)
target = TrackedPage(calls)
target.title = "目标窗口"
target.render(shared)
target.open(other)
first.activate()
ui.window().resize(800,600)
ui.window().setTitle("Tab Source")
ui.window().moveTo(50,80)
ui.window().focus()