组合键 应用

old_chen 2009-03-22 04:39:34
PB程序:
我有一张表,单击鼠标选择一行,如果按下CTRL键后点击则选择多行,如何编写程序?
...全文
174 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fjgzqjh 2009-05-18
  • 打赏
  • 举报
回复
參考pb8.0的pfc
eviler 2009-05-10
  • 打赏
  • 举报
回复
思路就是 key 判断按下的是什么键 ,然后使用 selectrow()
newease 2009-05-10
  • 打赏
  • 举报
回复
给你一段多行选择的代码,支持SHIFT 连选 CTRL 指定选择

string ls_KeyDownType
If rrow <= 0 then Return 0
If Keydown(KeyShift!) then
integer li_Idx
al_aclickedrow=rrow
this.setredraw(false)
this.selectrow(0,false)
If il_lastclickedrow = 0 then
this.setredraw(true)
Return 1
end if
if il_lastclickedrow > al_aclickedrow then
For li_Idx = il_lastclickedrow to al_aclickedrow STEP -1
this.selectrow(li_Idx,TRUE)
end for
else
For li_Idx = il_lastclickedrow to al_aclickedrow
this.selectrow(li_Idx,TRUE)
next
end if
this.setredraw(true)
Return 1
////////////////
ElseIf this.IsSelected(rrow) Then
il_LastClickedRow = rrow
ib_action_on_buttonup = true

ElseIf Keydown(KeyControl!) then
il_LastClickedRow = rrow
this.SelectRow(rrow,TRUE)

Else
il_LastClickedRow = rrow
this.SelectRow(0,FALSE)
this.SelectRow(rrow,TRUE)

End If
///////////////////

If ib_action_on_buttonup Then
ib_action_on_buttonup = false
If Keydown(KeyControl!) then
this.selectrow(il_lastclickedrow,FALSE)
Else
this.SelectRow(0,FALSE)
this.SelectRow(il_lastclickedrow,TRUE)
End If
il_lastclickedrow = 0
End If
qong010488 2009-05-10
  • 打赏
  • 举报
回复
如果不用按CTRL键也可以实现的,反而更省代码:
//clicked事件
if isselected(il_row) then
this.selectrow(il_row,false)
else
this.selectrow(il_row,true)
end if
jdsnhan 2009-03-22
  • 打赏
  • 举报
回复
google 上 baidu
sugarcubes 2009-03-22
  • 打赏
  • 举报
回复
If KeyDown ( keycontrol! ) Then
If This.IsSelected(row) Then
This.SelectRow(row,False)
Else
This.SelectRow(row,True)
End If
Else
This.SelectRow(0,False)
This.SelectRow(row,True)
This.SetRow(row)
End If
一个问题开俩帖子。你分很多啊。而且这段代码网上很容易搜出来!呵呵

743

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧