DATAWINDOW内限制多选问题,麻烦。。。

bcbhj 2003-09-02 09:59:35

这样一个DATAWINDOW: 20列,数据只有一行.
在这一行中选择3列,用点击方式,点了3个后就不可以再点其他了的,除非再点击已点过的那三列(恢复其未被点击的状态).这都实现了.可是在这20列中点了某列后其它的某几列是不可以点的,请问如何实现??????

如 datawindow : A B C D E F G......... 这一行的数据都不同.DATAWINDOW只有一行数据.
点了数据A就不可以点E和G,点了E就不可以点A和G,点了G就不可以点A和E.
A,B,C,D,E,F,G...所在的列也不确定,是变动的(确定就很容易实现了,哎,麻烦)
...全文
34 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
double22822 2003-09-02
  • 打赏
  • 举报
回复
把你所有的列做成包含所有项但不重复的几个数组,数组中的各项是不能同时选择的,点击某项是判断其所在数组的upbound 是否大于0。另外判断所有数组的upbound和是否小于3。
bcbhj 2003-09-02
  • 打赏
  • 举报
回复
dawindow里的数据不能修改,只供点击选择用的
bcbhj 2003-09-02
  • 打赏
  • 举报
回复
代码如下: 繁体字 不好意思(没办法,给台湾人做的)


string cname
if this.GetClickedColumn ( )<>0 and integer(This.Describe(dwo.name+ ".border"))<>0 then //and this.getitemstring(this.getrow(),this.getclickedcolumn())<>"" then
if this.getitemstring(this.getrow(),this.getclickedcolumn())<>"" then
cname=This.Describe(dwo.name+ ".border")

if left(trim(dwo.name),8)="process_" then
if integer(cname)<>6 and ch<=3 then
this.modify(dwo.name+".border=6")
this.modify(dwo.name+".Background.color=16750848") //11665407
ch++
elseif integer(cname)=6 and ch>=1 then
this.modify(dwo.name+".border=5")
this.modify(dwo.name+".Background.color=13554646") //13160666
ch=ch -1
end if
end if
int i,j

choose case this.getitemstring(this.getrow(),this.GetClickedColumn ( ))
case "﹚"
if integer(This.Describe(dwo.name+ ".border"))=6 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="攫" or this.getitemstring(this.getrow(),i) ="琗硁" then
this.Modify("process_"+string(i)+".border=0")
end if
next
elseif integer(This.Describe(dwo.name+ ".border"))=5 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="攫" or this.getitemstring(this.getrow(),i) ="琗硁" then
this.Modify("process_"+string(i)+".border=5")
end if
next
end if
case "攫"
if integer(This.Describe(dwo.name+ ".border"))=6 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="﹚" or this.getitemstring(this.getrow(),i) ="琗硁" then
this.Modify("process_"+string(i)+".border=0")
end if
next
elseif integer(This.Describe(dwo.name+ ".border"))=5 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="﹚" or this.getitemstring(this.getrow(),i) ="琗硁" then
this.Modify("process_"+string(i)+".border=5")
end if
next
end if
case "琗硁"
if integer(This.Describe(dwo.name+ ".border"))=6 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="攫" or this.getitemstring(this.getrow(),i) ="﹚" then
this.Modify("process_"+string(i)+".border=0")
end if
next
elseif integer(This.Describe(dwo.name+ ".border"))=5 then
for i =1 to 20
if this.getitemstring(this.getrow(),i) ="攫" or this.getitemstring(this.getrow(),i) ="﹚" then
this.Modify("process_"+string(i)+".border=5")
end if
next
end if
end choose

/*
cname=This.Describe(dwo.name+ ".border")

if left(trim(dwo.name),8)="process_" and this.getitemstring(this.getrow(),this.getclickedcolumn())<>"" then
if integer(cname)<>6 and ch<=3 then
this.modify(dwo.name+".border=6")
this.modify(dwo.name+".Background.color=16750848") //11665407
ch++
elseif integer(cname)=6 and ch>=1 then
this.modify(dwo.name+".border=5")
this.modify(dwo.name+".Background.color=13554646") //13160666
ch=ch -1
end if
end if*/
//case "攫"
// return
//case "琗硁"
//return
//end choose
end if
end if
bcbhj 2003-09-02
  • 打赏
  • 举报
回复
每列的Tab Order都为0,和tab无关.
经一番测试,我自己解决了.
大家有无好点子
godofn 2003-09-02
  • 打赏
  • 举报
回复
再:Tab Order 属性会导致选择3个以后无法改变已经选择的项,所以不能使用,用户会有误操作,如果使用Tab Order 将限制修改。
godofn 2003-09-02
  • 打赏
  • 举报
回复
你可以在数据源中设置计算列,“0 as count”,然后在程序中的itemchanged事件中判断你的多选列是否发生改变,每次改变都统计已经确定的列,如果已经选了3个就提示,并同时将刚才所选的列设置为非选则状态。

其实还有一个比较麻烦一点的办法,但是稳定性比较强,就是使用共享数据窗口,两个数据窗口控件使用同一个数据窗口,当你选择的时候用rowscopy函数将该列拷贝到第二个数据窗口控件中,利用第二个数据窗口的行数来控制第一个数据窗口的选择,当然,不能用锁定和“无效”的方法来控制,只能用提示信息和你手动控制的办法来控制用户的选择。
eminena 2003-09-02
  • 打赏
  • 举报
回复
用 modify() 函数 动态修改 列的 Tab Order 属性.
netspies 2003-09-02
  • 打赏
  • 举报
回复
说的不太清楚
bcbhj 2003-09-02
  • 打赏
  • 举报
回复
...................................
liliang800207 2003-09-02
  • 打赏
  • 举报
回复
关注

1,108

社区成员

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

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