PB is implemented in a data window in a data window in a data window, and displays the sort arrow.

zhaozj2021-02-17  57

// Function Name: f_dwsort (DataWindow FDW_DW, DWObject FDWO_DWO) Return None

// Description: Used to simulate the resource manager mouse in the data window to dynamically sort, and display the sort arrow

// Call rule: write f_dwsort (this, dwo) in Data Window Control Clicked!

// Parameter: fdw_dw datawindow

// FDWO_DWO DWOBJECT

// Return value: no

// autor: xiaoluoxy Xiao Yun

String ls_clicked_pos, ls_col, ls_format, ls_tag

Long LL_POS

String ls_text, ls_column []

INT Li_i

LS_Clicked_POS = fdwo_dwo.name

LL_POS = POS (ls_clicked_pos, '_ t')

IF ll_pos> 0 THEN

// Setting Sort

LS_COL = Left (ls_clicked_pos, ll_pos -1)

LS_TAG = fdwo_dwo.tag

IF ls_tag = ls_col "a" THEN

FDWO_DWO.TAG = LS_COL "D"

LS_FORMAT = LS_COL "a"

Elseif ls_tag = ls_col "d" THEN

FDWO_DWO.TAG = LS_COL "a"

LS_FORMAT = LS_COL "D"

Else

FDWO_DWO.TAG = LS_COL "D"

LS_FORMAT = LS_COL "a"

END IF

// Set the column header

For li_i = 1 to long (fdw_dw.object.dataWindow.column.count)

LS_COLUMN [Li_i] = fdw_dw.describe ("#" string (li_i) ".name") // Get column name

LS_Text = fdw_dw.describe (ls_column [li_i] "_t.text")

IF Right (Ls_Text, 2) = "▽" or right (ls_text, 2) = "△" THEN

Ls_text = left (ls_text, len (ls_text) - 2)

END IF

FDW_DW.MODIFY (ls_column [li_i] "_t.text = '" ls_text "")

NEXT

Ls_text = fdw_dw.describe (ls_clicked_pos ".text")

IF Right (Ls_Text, 2) = "▽" or right (ls_text, 2) = "△" THEN

Ls_text = left (ls_text, len (ls_text) - 2)

END IF

IF Right (Ls_Format, 1) = 'a' Then

FDW_DW.MODIFY (ls_clicked_pos ".text = '" ls_text "△'")

Elseif Right (Ls_Format, 1) = 'd' tfdw_dw.modify (ls_clicked_pos ".text = '" ls_text "▽'")

END IF

FDW_DW.SETSORT (Ls_Format)

FDW_DW.SORT ()

END IF

// This program passes the test under PB6.5

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

New Post(0)