1。在要排序的块上建立:when-mouse-click trigger,代码:
:global.mouserecord := :system.mouse_record;
:global.mouseitem := :system.mouse_item;
2。建立排序弹出菜单
正排序,代码:sort_asc(substr(:global.mouseitem,1,instr(:global.mouseitem,'.')-1)); --括号内的是鼠标所在的块名
反排序,代码:sort_desc(substr(:global.mouseitem,1,instr(:global.mouseitem,'.')-1));
不排序,代码:sort_no(substr(:global.mouseitem,1,instr(:global.mouseitem,'.')-1));
3。建立三个排序程序单元:
PROCEDURE sort_asc(blockname varchar) IS
BEGIN
set_block_property(blockname,order_by,substr(:global.mouseitem,instr(:global.mouseitem,'.')+1,999));
go_block(blockname);
execute_query;
go_record(:global.mouserecord);
go_item(:global.mouseitem);
END;
PROCEDURE sort_desc(blockname varchar) IS
BEGIN
set_block_property(blockname,order_by,substr(:global.mouseitem,instr(:global.mouseitem,'.')+1,999) ' desc');
go_block(blockname);
execute_query;
go_record(:global.mouserecord);
go_item(:global.mouseitem);
END;
PROCEDURE sort_no(blockname varchar) IS
BEGIN
set_block_property(blockname,order_by,'');
go_block(blockname);
execute_query;
go_record(:global.mouserecord);
go_item(:global.mouseitem);
END;
4。在字段上指定弹出菜单的名称
---- 本文为原创,by armok.