关于datawindow的两个问题?

seayoungcn 2003-08-11 11:58:35
grid风格的datawindow:
1.当点击列标题时,列被选中(黑色区域),可否只触发clicked事件而不出现被选中的区域?因为我只想在clicked事件中增加排序代码,不想要选中效果。
2.可否实现按下ctrl键的多行选择?
...全文
54 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
klbt 2003-08-11
  • 打赏
  • 举报
回复
2.可否实现按下ctrl键的多行选择?
可以,csdn上应该有很多例子,可以自己查找,主要通过key事件,selectedrow函数等实现
byfq 2003-08-11
  • 打赏
  • 举报
回复
1、去掉column moveing属性
2、看看pb自身的例子
runsoft 2003-08-11
  • 打赏
  • 举报
回复
//----------------------------------------------------------
// 代码描述: 1.点击表格的题头进行排序(升序降序切换)
// 2.点击时选中某一行或组合键选中多行(Ctrl,Shift)
// 入口参数: key_orde (long)
// is_ordercol (string)
// is_sorttype (string)
// 出口参数:无

//-----------------------------------------------------------

long ll_rowkeydown
long j
string ls_AddPict
string ls_CurObj
string ls_Picture
string ls_CurCol
integer li_PictPos

// 点击表格的题头进行排序
ls_CurObj = String(dwo.Name)
If Row = 0 AND &
This.Describe(ls_CurObj + ".Text") <> "!" AND &
This.Describe(ls_CurObj + ".Band") = "header" Then // Valid header object?
ls_CurCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
If is_OrderCol <> ls_CurCol Then // Different Column
This.Modify("DESTROY p_" + is_OrderCol)
is_OrderCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
ls_Picture = ".\image\ORDERUP.BMP"
is_SortType = "A" // Ascending sort
li_PictPos = Integer(This.Describe(ls_CurObj + ".X"))+ (Integer(This.Describe(ls_CurObj + ".Width")) - 70)
ls_AddPict ='create bitmap(band=foreground filename="' + ls_Picture + '" ' + &
' x="' + String(li_PictPos) + "~tInteger(describe('" + is_OrderCol + &
".X')) + (Integer(describe('" + is_OrderCol + ".Width'))" + ' - 70)" y="24" ' + &
' height="33" width="51" border="0" name=p_' + is_OrderCol + ' visible="1")'
This.Modify(ls_AddPict)
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
Else
If is_SortType = "A" Then
ls_Picture = ".\image\ORDERDW.BMP"
is_SortType = "D"
Else
ls_Picture = ".\image\ORDERUP.BMP"
is_SortType = "A"
End If
This.Modify('p_' + is_OrderCol + '.filename = "' + ls_Picture + '"')
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
End If
End If


// 点击时选中某一行或组合键选中多行(Ctrl,Shift)
ll_rowkeydown = this.getclickedrow()
if ll_rowkeydown = 0 or isnull(ll_rowkeydown) then return
if keydown(keycontrol!) then
if isselected(ll_rowkeydown) then
selectrow(ll_rowkeydown,false)
else
selectrow(ll_rowkeydown,true)
end if
key_orde = ll_rowkeydown
else
if keydown(keyshift!) then
this.selectrow(0,false)
if ll_rowkeydown > key_orde then
for j=key_orde to ll_rowkeydown
this.selectrow(j,true)
end for
else
for j= key_orde to ll_rowkeydown step -1
this.selectrow(j,true)
end for
end if
key_orde = ll_rowkeydown
else
this.selectrow(0,false)
this.selectrow(ll_rowkeydown,true)
this.setrow(row)
this.setrowfocusindicator(hand!)
key_orde = ll_rowkeydown
end if
end if


1,109

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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