How to get the number of columns displayed in the data window in pb programming

1. Get the band where the object currently pointed by the mouse is located.

string str_band

str_band=GetBandAtPointer() //Get the band where the object currently pointed by the mouse is located. Band area

str_band=left(str_band, (pos(str_band,'~t') - 1))//Get "header", "detail", etc.

if str_bandlt; gt; 'header' then return //Click the non-header area to exit

2. Get the column object name pointed by the mouse

str_object=GetObjectAtPointer() //Get the current mouse pointer Refers to the object name

str_object=left(str_object, (pos(str_object,'~t') - 1))

//Get the column object name (default is column name_t is the column title)

str_column=left(str_object, (len(str_title) - 2))

//Determine whether the name is a column name

if this.describe(str_column ".band")='!' then return //It is not a column name, that is, the column title is not named according to normal rules.

3. Get the current row, column, total rows and columns //this is for the data window

li_col = this.GetColumn()

li_ColCount = long (describe(this, "datawindow.column.count"))

ll_row = this.GetRow()

ll_RowCount = this.RowCount()

/ /Set the current row and column

scrolltorow(this, ll_Row)

setrow(this, ll_Row)

setcolumn(this, li_col)

this.SetFocus()

4. Get all column titles

ll_colnum = Long(dw_1.object.datawindow.column.count)

for i = 1 to ll_colnum

//Get the name of the title header

ls_colname = dw_1.describe('#' string(i) ".name") "_t"

 ls_value = dw_1.describe(ls_colname ".text")

next

5. How to use code to obtain the value of the calculated column in the data window summary?

String ls_value

ls_value = dw_1.Describe("Evaluate("'compute_1', 1)")

//If it is a numeric type, it needs to be converted.