Little experience in the dataWindow control, getChild () function

zhaozj2021-02-16  44

In the process of software development, I have experienced some problems with the getchild function. I want to have it to come out and discuss it. Please tell us to quit. In DataWindow, the getChild function is mainly used to get a sub-data window of a data window, the format is as follows: Data window control name. (Column name, user-defined sub-data window variable)

Such as: a), dw_cx.getchild ("XT_CZY", DWC_CX)

b), dw_tj.getchild ("dw_1", dwc_tj)

This function can use, 1, remove the drop-down data window of the data window object; 2. Remove the sub-data window objects embedded in the composite style data window object.

It is necessary to pay attention to the second case. Be sure to use the sub-data window in the Composite style data window to use the function, if it is something else, the function returns -1, indicating that the execution failed. (I used Freedom to nest a sub-data window, then use getChild (), resulting failed.); Another note is that if it is a Composite Data window, the first parameter of the getChild () function is sub-data The name of the window (you need yourself) instead of the name of the sub-data window object. If the sub-data window is a drop-down data window, the parameter is the column name. The second parameter is the user-defined sub-data window variable. After performing getChild (), this variable is the sub-data window obtained, which can be filtered, sorted, and the like.

For example, this program takes out two sub-data windows of a Composite data window object and filters them, and sorted. / * DW_DY is a data window control that connects a Composite Data Window object. DW_1, DW_2 is Name * / of nested data windows, respectively.

String ls_filter

DataWindowChild DWC_CZRW, DWC_CZX / / Define sub-data window variable

DW_DY.SETTRANSOBJECT (SQLCA)

dw_dy.retrieve ()

DW_DY.GETCHILD ("dw_2", dwc_czrw)

DW_DY.GETCHILD ("dw_1", dwc_czx)

Ls_filter = "CZRW_BH = '" dw_3.getItemString (dw_3.getrow (), "CZRW_BH") "'" // filter condition

DWC_CZRW.SETFILTER (LS_FILTER)

DWC_CZRW.FILTER ()

Ls_filter = "CZX_RWBH = '" dw_3.getItemString (dw_3.getrow (), "CZRW_BH") "'"

DWC_CZX.SETSORT ("CZX_SX A")

DWC_CZX.SORT ()

DWC_CZX.SetFilter (ls_filter)

DWC_CZX.FILTER ()

Of course, you can also operate the data in the subtadata window by data sharing (Sharedata).

Email: oceanaut@163.com

转载请注明原文地址:https://www.9cbs.com/read-26089.html

New Post(0)