try(mainWindowDef.close())catch()
struct mainWindowDef
(
title = "Main Window",
roll = rollout roll ""
(
local _this
fn created =
(
roll.title = _this.title
)
),
fn close =
(
try(
destroyDialog this.roll
)
catch()
),
fn show =
(
--关闭,_this被销毁
this.close()
--创建,_this初始为undefined
createDialog this.roll 500 300
--赋值,_this指向当前结构体实例
this.roll._this = this
--使用函数代替on open do
this.roll.created()
)
)
global mainWindowDef = mainWindowDef()
mainWindowDef.show()