窗口的control []数组中的项目顺序

问题描述 投票:0回答:1

在窗口中有一个control []数组,窗口中有控件。有人知道那个control []数组中控件顺序的算法是什么?有时候在开发模式中改变了这个顺序,我不知道为什么。我有一个很大的问题

请帮忙

powerbuilder
1个回答
0
投票

在内部create和destroy事件中创建和销毁控件时,将维护powerbuilder可视对象容器(userobject,window等)中的控件数组。这些通常按照您将控件放在容器上的顺序。因此,例如,如果我们查看源代码(右键单击系统树中的对象并选择“编辑源”或导出到src文件),该窗口名为“w_my_window”,其中我创建了两个命令按钮和一个数据窗口:

on w_my_window.create
int iCurrent
call super::create
this.cb_1=create cb_1
this.cb_2=create cb_2
this.dw_1=create dw_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_1
this.Control[iCurrent+2]=this.cb_2
this.Control[iCurrent+3]=this.dw_1
end on

on w_my_window.destroy
call super::destroy
destroy(this.cb_1)
destroy(this.cb_2)
destroy(this.dw_1)
end on

请注意,如果您以这种方式编码(即使用Create / OpenUserObject动态创建控件),则可以在其他事件和函数中的其他时间创建和销毁控件,这样做也会影响控件数组。

另请注意,控件数组是基于祖先发生的事情构建的,后代将继续在此控件数组上构建。

为清楚起见,这些都不适用于数据窗口内的对象。

© www.soinside.com 2019 - 2024. All rights reserved.