实际问题:
以2K4为例,在批号工序报告时,每报表一次,系统会自动刷新并且把MOUSE指向第一行且选中;
造成的困扰是,资料比较多时,USER查找批号/工序资料耗时
解决办法:
写一刷新过程,目的是在刷新前记下当前行号,再执行刷新过程,然后再选中记下的行号;
实现方法:
Step1) 新定义一变量 nMyRow;
Step2) 刷新前记下当前行号 例如:Set nMyRow = nRow
Step3) 写Refresh过程
Function: Refresh
Description:
Returns
Parameters
Static Variables
Local variables
Actions
--执行刷新动作
Call SalSendMsg( i_hWndFrame, PM_DataSourceRefresh, METHOD_Execute, 0 )
--把已选中的行,取消选中
Set nRow = TBL_MinRow
While SalTblFindNextRow( hWndForm, nRow, ROW_Selected, 0)
Call SalTblSetRowFlags( hWndForm, nRow, ROW_Selected, FALSE)
--改变焦点位置并且选中刷新前的行
Call SalTblSetFocusRow ( hWndForm, nMyRow )
Call SalTblSetRowFlags( hWndForm, nMyRow, ROW_Selected, TRUE )
Step4) 在需要刷新的地方调用 Call Refresh();
GAME OVER! foreveryday007 20051216
F1 HELP
1>
bOk = SalTblSetFocusRow ( hWndTbl, nRow )
Sets a table window's focus frame row.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window.
nRowNumber. The row number of the row to which to apply the focus frame.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
IFS Client Developer
2>
bOk = SalTblSetRowFlags ( hWndTbl, nRow, nFlags, bSet )
Sets or clears a table window row's flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window.
nRowNumber. The row number of the row whose flags you want to set or clear.
nFlags Number. The row flags. You can combine any of the ROW_* flags using the OR (|) operator.
bSet Boolean. Whether to set (TRUE) or clear (FALSE) the specified flags.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
The internal function SelectAllRows loops through all rows in a scroll range, selecting each one. SalTblQueryScroll gets the scroll range, and SalTblSetRowFlags selects each row by setting its ROW_Selected flag.
Internal Functions
Function: SelectAllRows
...
Actions
Call SalTblQueryScroll ( hWndTbl, nPosRow, nMinRow, nMaxRow )
Set nRow = nMinRow
While ( nRow <= nMaxRow )
Call SalTblSetRowFlags ( hWndTbl, nRow, ROW_Selected, TRUE )
Set nRow = nRow + 1
IFS Client Developer