执行 win.ui.tabs 的 clear() 函数后,会导致程序报错。

因为这个函数,清除了tabs的第1个项目,从而导致 tabList[1].setTimeout() 函数中访问该项目时出错。
测试代码如下:
Code AardioLine:13复制
1.2.3.4.5.6.7.8.9.10.11.12.13.import
win
.ui;var
winform = win
.form(text="aardio form"
;right=759
;bottom=469
)- winform.add({
- plus={cls=
"plus"
;text="111111"
;left=224
;top=184
;right=360
;bottom=248
;forecolor=32768
;z=1
}; - plus2={cls=
"plus"
;text="22222"
;left=368
;top=184
;right=504
;bottom=248
;forecolor=32768
;z=2
} - })
- winform.show();
import
win
.ui.tabsvar
tabs = win
.ui.tabs(winform.plus,winform.plus2);- tabs.clear();
win
.loopMessage();
修改方法:
将 win.ui.tabs 库文件的如下代码:
Code AardioLine:17复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.if
(defaultStyle){-
this
.tabList[1
].setTimeout( -
function
(){ -
if
(!this
.style){ -
var
$fixDefaultStyle = { - color =
this
.tabList[1
].argbColor; - foreground =
this
.tabList[1
].getForeground(); - }
-
-
this
.skin( ..table
.clone(defaultStyle)); -
-
-
this
.$fixDefaultStyle = $fixDefaultStyle; - }
- },
100
- )
- }
改为:
Code AardioLine:17复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.if
(defaultStyle){-
this
.tabListargbColor = this
.tabList[1
].argbColor; -
this
.tabListgetForeground = this
.tabList[1
].getForeground(); -
this
.tabList[1
].setTimeout( -
function
(){ -
if
(!this
.style){ -
var
$fixDefaultStyle = { - color =
this
.tabListargbColor; - foreground =
this
.tabListgetForeground; - }
-
this
.skin( ..table
.clone(defaultStyle)); -
-
this
.$fixDefaultStyle = $fixDefaultStyle; - }
- },
100
- )
- }