feat: retain managed visual objects and dispatch native input through Endor
Verify Tessera GUI / verify (push) Successful in 9m28s
Verify Tessera GUI / verify (push) Successful in 9m28s
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
| File | Purpose |
|
||||
| --- | --- |
|
||||
| [classes.endor](classes.endor) | Endor class fields, inheritance, overriding, a retained receiver and Event arguments; native keyboard input updates shared model properties. |
|
||||
| [managed-types.endor](managed-types.endor) | Callable managed Endor types, one shared counter, two bound displays and a language callback invoked from native Button input. |
|
||||
| [page.endor](page.endor) | Four top-level statements construct text, a rectangle and a page, then call page.render; no main wrapper. |
|
||||
| [main.endor](main.endor) | The earlier function-entry form, producing the same frame as page.endor. |
|
||||
| [hello.endor](hello.endor) | Richer function-entry example covering a helper, Row/Column and Spacer. |
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
class Counter {
|
||||
value: Number
|
||||
lastEvent: String
|
||||
|
||||
function activate(self: Counter, event: Event): Unit {
|
||||
self.lastEvent = event.kind
|
||||
self.change()
|
||||
}
|
||||
|
||||
function change(self: Counter): Unit {
|
||||
self.value = 10
|
||||
}
|
||||
}
|
||||
|
||||
class DemoCounter: Counter {
|
||||
function change(self: DemoCounter): Unit {
|
||||
self.value = 12
|
||||
}
|
||||
}
|
||||
|
||||
model = DemoCounter(9, "等待点击")
|
||||
first = ui.textOf(model, "value", 2)
|
||||
second = ui.textOf(model, "value", 2)
|
||||
eventName = ui.textOf(model, "lastEvent")
|
||||
button = Button("调用继承方法,再分派到覆盖方法")
|
||||
button.onClick(model.activate)
|
||||
page = Page()
|
||||
page.render(Column(24, 16, TextBlock("Endor class:继承、self 与动态方法分派", 2), Row(0, 16, first, second), button, eventName))
|
||||
@@ -0,0 +1,9 @@
|
||||
counter = ui.state(9)
|
||||
first = ui.textOf(counter, "value", 2)
|
||||
second = ui.textOf(counter, "value", 2)
|
||||
title = TextBlock("Endor:同一份对象,代码与 GUI 共同操作", 2)
|
||||
button = Button("增加计数")
|
||||
function increment(): Unit { counter.increment() }
|
||||
button.onClick(increment)
|
||||
page = Page()
|
||||
page.render(Column(24, 16, title, Row(0, 16, first, second, button)))
|
||||
Reference in New Issue
Block a user