搜索后重置单元格背景色

This commit is contained in:
阿甘 2024-06-16 22:19:47 +08:00
parent a9cbf6cc26
commit d2c7437fcd

View File

@ -292,6 +292,9 @@ g_teMenus.setCommandFunc(0, 11, g_teMenus.showAbout);
g_teMenus.setCommandFunc(1, 1, g_teMenus.showHelp);
/*}}*/
pre_searched_row = null;
pre_searched_col = null;
/*消息回调{{*/
g_flexcell.onCellChange = function(Row,Col){
if(!g_flexcell.isModified){
@ -312,6 +315,16 @@ g_flexcell.onMouseUp = function(Button , Shift, x, y){
if(Button == 2){
g_flexcell.cell(g_flexcell.MouseRow,g_flexcell.MouseCol).Select();
}
if(pre_searched_row != null and pre_searched_col != null){
g_flexcell.Cell(pre_searched_row, pre_searched_col).BackColor = 0xffffff;
}
}
g_flexcell.onSelChange = function(FirstRow,FirstCol,LastRow,LastCol){
/*** 在Selection选择范围改变时发生。参数起始行起始列结束行结束列 ***/
var row1,col1=owner.toRelativeRow(FirstRow),owner.toRelativeCol(FirstCol);
var row2,col2=owner.toRelativeRow(LastRow),owner.toRelativeCol(LastCol);
console.log(row1, col1, row2, col2)
}
/*}}*/
@ -327,8 +340,6 @@ var accelerator = win.ui.accelerator({
};
},mainForm );
pre_searched_row = null;
pre_searched_col = null;
research_flag = true;
searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, str){
if(isRangeSearch){// 从一个范围开始搜索
@ -400,6 +411,7 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange
}
subscribe("search_prev",function(...){
// TODO
console.dump(...);
} )
@ -414,6 +426,9 @@ subscribe("search_next",function(...){
if(firstRow != lastRow or firstCol != lastCol){
isRangeSearch = true;
}
if(pre_searched_row != null and pre_searched_col != null){
g_flexcell.Cell(pre_searched_row, pre_searched_col).BackColor = 0xffffff;
}
var row, col = searchNextContent(g_flexcell.getVlistData(), firstRow, firstCol, lastRow, lastCol, isRangeSearch, firstRow, firstCol, ...);
//console.dump(row, col);
if(row != null && col != null){