feat: construct native visual subclasses from Endor source
Verify Tessera GUI / verify (push) Successful in 9m53s
Verify Tessera GUI / verify (push) Successful in 9m53s
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
| File | Purpose |
|
||||
| --- | --- |
|
||||
| [native-subclasses.endor](native-subclasses.endor) | Real native TextBlock/Button/Page source subclasses, inherited fields, method overrides and shared field bindings. |
|
||||
| [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. |
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
class StatusText: TextBlock {
|
||||
activeColor: String
|
||||
|
||||
function activate(self: StatusText, event: Event): Unit {
|
||||
self.setText("继承的原生文本已更新")
|
||||
self.setColor(self.activeColor)
|
||||
}
|
||||
}
|
||||
|
||||
class CustomStatus: StatusText {
|
||||
message: String
|
||||
|
||||
function activate(self: CustomStatus, event: Event): Unit {
|
||||
TextBlock.setText(self, self.message)
|
||||
self.setColor(self.activeColor)
|
||||
}
|
||||
}
|
||||
|
||||
class ActionButton: Button {
|
||||
target: Block
|
||||
|
||||
function activate(self: ActionButton, event: Event): Unit {
|
||||
self.target.activate(event)
|
||||
}
|
||||
}
|
||||
|
||||
class CustomPage: Page {
|
||||
caption: String
|
||||
}
|
||||
|
||||
label = CustomStatus("点击按钮更新同一个自定义文本对象", 2, "#242422", "#237A45", "源码子类与原生载荷共同工作")
|
||||
button = ActionButton("调用源码子类方法", label)
|
||||
button.onClick(button.activate)
|
||||
page = CustomPage("Endor 原生类型的源码继承")
|
||||
page.render(Column(24, 16, TextBlock(page.caption, 2), label, label, button, ui.textOf(label, "message")))
|
||||
Reference in New Issue
Block a user