PB 数据窗口实现多选行

该项功能是在数据窗口的单击事件中实现。
(P11.5中调试通过)
程序分析:

1、首先定义整型实例变量prerow记录按住Ctrl键和Shift键时点击的行号。

2、根据不同的按键执行不同的操作。

具体代码如下:

/*===================================*
         ↓↓ 多选功能 ↓↓
*===================================*/
// 临时记录行号
long temprow

if row <> 0 then // 只有点击行时执行下面操作 
if keyDown(KeyControl!) then // 按下“Ctrl”键时
   if isselected(row) then
    SelectRow (row, false)
   else
    selectrow (row, true)
   end if
   prerow = row
Elseif KeyDown(KeyShift!) then // 按下“Shift”键时
   SelectRow (0, false)
   choose case true
    case prerow < row
     temprow = prerow
     do while temprow <= row
      selectrow (temprow, true)
      temprow += 1
     loop
    case prerow > row
     temprow = prerow
     do while temprow >= row
      selectrow (temprow, true)
      temprow -= 1
     loop
    case prerow = row
     selectrow (row, true)
   end choose
else // 按下其它键或不按键时
   SelectRow (0, false)
   SelectRow (row, true)
   prerow = row
end if
else // 没有点击行时,全部取消选择
SelectRow (0, false)
end if 
/*===================================*
         ↑↑ 多选功能 ↑↑
*===================================*/
 
 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值