增加添加行列弹出菜单,优化部分代码

This commit is contained in:
一二三 2024-06-18 22:59:26 +08:00
parent 947f767ac9
commit 662a00aed3
4 changed files with 56 additions and 2 deletions

View File

@ -1,6 +1,11 @@
//flexcell-智能提示 //flexcell-智能提示
//内购版本,严禁外传 //内购版本,严禁外传
import com.activeX;
import util.metaProperty;
import gdip;
import fsys;
if ..io.exist("/lib/flexcell/user.aardio") if ..io.exist("/lib/flexcell/user.aardio")
loadcodex("/lib/flexcell/user.aardio","flexcell"); loadcodex("/lib/flexcell/user.aardio","flexcell");
else loadcodex($"/lib/flexcell/user.lib"); else loadcodex($"/lib/flexcell/user.lib");

Binary file not shown.

View File

@ -55,6 +55,9 @@ initFlexCellShow = function(fc){
fc.AutoRedraw = false; fc.AutoRedraw = false;
fc.setTable(t, t.fields, t.fields); fc.setTable(t, t.fields, t.fields);
fc.column(0).AutoFit(); fc.column(0).AutoFit();
if(fc.Column(0).Width < 40){
fc.Column(0).Width = 40;
}
fc.AutoRedraw = true; fc.AutoRedraw = true;
fc.Refresh(); fc.Refresh();
} }

View File

@ -10,7 +10,7 @@ import flexcell;
import teUtils; import teUtils;
import teMenu; import teMenu;
/*DSG{{*/ /*DSG{{*/
var mainForm = win.form(text="TabEditor--";right=1399;bottom=799;bgcolor=16777215) var mainForm = win.form(text="TabEditor++";right=1399;bottom=799;bgcolor=16777215)
mainForm.add( mainForm.add(
custom={cls="custom";text="自定义控件";left=0;top=36;right=1400;bottom=800;ah=1;aw=1;bgcolor=12639424;db=1;dl=1;dr=1;dt=1;z=2}; custom={cls="custom";text="自定义控件";left=0;top=36;right=1400;bottom=800;ah=1;aw=1;bgcolor=12639424;db=1;dl=1;dr=1;dt=1;z=2};
plus={cls="plus";left=0;top=0;right=1400;bottom=36;bgcolor=16777215;border={left=1;top=1;right=1;color=-6250332};clipBk=false;clipch=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-18);forecolor=16777215;notify=1;repeat="stretch";z=1} plus={cls="plus";left=0;top=0;right=1400;bottom=36;bgcolor=16777215;border={left=1;top=1;right=1;color=-6250332};clipBk=false;clipch=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-18);forecolor=16777215;notify=1;repeat="stretch";z=1}
@ -86,8 +86,13 @@ g_teMenus.openFile = function(ctrl){
mainForm.g_flexcell.AutoRedraw = false; mainForm.g_flexcell.AutoRedraw = false;
mainForm.g_flexcell.setTable(t,,t.fields); mainForm.g_flexcell.setTable(t,,t.fields);
mainForm.g_flexcell.column(0).AutoFit(); mainForm.g_flexcell.column(0).AutoFit();
if(mainForm.g_flexcell.Column(0).Width < 40){
mainForm.g_flexcell.Column(0).Width = 40;
}
mainForm.g_flexcell.AutoRedraw = true; mainForm.g_flexcell.AutoRedraw = true;
mainForm.g_flexcell.Refresh(); mainForm.g_flexcell.Refresh();
collectgarbage("collect");
collectgarbage("collect");
} }
} }
} }
@ -296,6 +301,40 @@ mainForm.g_flexcell.onClick = function(Row,Col){
var row,col=owner.toRelativeRow(Row),owner.toRelativeCol(Col); var row,col=owner.toRelativeRow(Row),owner.toRelativeCol(Col);
} }
//左侧弹出菜单
mainForm.popmenuLeft = win.ui.popmenu(mainForm);
mainForm.popmenuLeft.add('向上插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
} )
mainForm.popmenuLeft.add('向下插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow + 1, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
} )
//右侧弹出菜单
mainForm.popmenuRight = win.ui.popmenu(mainForm);
mainForm.popmenuRight.add('向左插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
} )
mainForm.popmenuRight.add('向右插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol+1, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
} )
mainForm.g_flexcell.onMouseUp = function(Button , Shift, x, y){ mainForm.g_flexcell.onMouseUp = function(Button , Shift, x, y){
/*** 鼠标按键放开。 /*** 鼠标按键放开。
Button 当前按下的鼠标按钮1左按钮2右按钮4中间按钮同时按下时执行位或操作。 Button 当前按下的鼠标按钮1左按钮2右按钮4中间按钮同时按下时执行位或操作。
@ -303,6 +342,13 @@ mainForm.g_flexcell.onMouseUp = function(Button , Shift, x, y){
x,y 鼠标指针当前位置 ***/ x,y 鼠标指针当前位置 ***/
if(Button == 2){ if(Button == 2){
mainForm.g_flexcell.cell(mainForm.g_flexcell.MouseRow, mainForm.g_flexcell.MouseCol).Select(); mainForm.g_flexcell.cell(mainForm.g_flexcell.MouseRow, mainForm.g_flexcell.MouseCol).Select();
var x,y = win.getMessagePos();
if(mainForm.g_flexcell.MouseCol == 0){
mainForm.popmenuLeft.popup(x,y,true)
}
elseif(mainForm.g_flexcell.MouseRow == 0){
mainForm.popmenuRight.popup(x,y,true)
}
} }
if(pre_searched_row != null and pre_searched_col != null){ if(pre_searched_row != null and pre_searched_col != null){
mainForm.g_flexcell.Cell(pre_searched_row, pre_searched_col).BackColor = 0xffffff; mainForm.g_flexcell.Cell(pre_searched_row, pre_searched_col).BackColor = 0xffffff;