31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
class Painted: RectBlock {
|
|
function paint(self: Painted, mount: Mount, geometry: Bounds): DisplayList {
|
|
return RectBlock.paint(self,mount,geometry)
|
|
}
|
|
}
|
|
class Actions {
|
|
count: Object
|
|
function click(self: Actions, event: Event): Unit { self.count.increment() }
|
|
}
|
|
count = ui.state(0)
|
|
actions = Actions(count)
|
|
first = Button("顶部按钮")
|
|
middle = Button("中间按钮")
|
|
last = Button("底部按钮")
|
|
firstConnection = first.on("click",actions.click)
|
|
middleConnection = middle.on("click",actions.click)
|
|
lastConnection = last.on("click",actions.click)
|
|
body = Column(12,12,first,Painted(520,180,8,"#DCE8FF"),middle,RectBlock(520,180,8,"#E3EFE5"),last)
|
|
scroller = ScrollBlock(320,180,body)
|
|
root = Column(24,16,TextBlock("同一 Block,两处 Mount 独立滚动"),ui.textOf(count,"value"),scroller)
|
|
page = Page()
|
|
page.title = "滚动示例"
|
|
page.render(root)
|
|
other = Window()
|
|
other.setTitle("Scroll Secondary")
|
|
second = Page()
|
|
second.title = "独立滚动位置"
|
|
second.open(other)
|
|
second.render(root)
|
|
ui.window().setTitle("Scroll Primary")
|