pb 新增节点时点击增加怎么一下新增了两个节点?应该是一个节点才对的!

guotangyu 2009-04-09 10:03:03
pb 新增节点时点击增加怎么一下新增了两个节点?应该是一个节点才对的!
...全文
181 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Awang_126 2009-04-09
  • 打赏
  • 举报
回复
就是在增加节点之前,你那样判断下就可以
guotangyu 2009-04-09
  • 打赏
  • 举报
回复
是不是在我的基础上加上这个if tv_cur.ExpandedOnce=true and tv_cur.Children=true then
判断就可以了?怎么我的加上就在界面上新增没有显示了
Awang_126 2009-04-09
  • 打赏
  • 举报
回复
一个是你自己增加的,还有个是itempopulate触发时自动增加的

你可以在增加的时候这样处理

给你参考个代码
treeviewitem tv_cur,tv_new
long ll_root,new_handle
string ls_closetype
//
ist_parm.opentype = "add"
ls_closetype = gs_closetype
ist_parm.int2 = ai_parentid
gs_closetype = '0'
openwithparm(w_knowledge_add,ist_parm,this)
if gs_closetype='1' then
//如果是点击确定按钮 或者 取消按钮
ist_parm = message.powerobjectparm
if ist_parm.closetype='ok' then
ll_root = tv_1.getitem(al_handle,tv_cur)
if ll_root<>-1 then

if tv_cur.ExpandedOnce=true and tv_cur.Children=true then
//如果当前节点已经存在子节点
tv_new.SelectedPictureIndex = 3
tv_new.PictureIndex = 2

tv_new.label = ist_parm.string4
if ist_parm.int4<5 then tv_new.label = tv_new.label +"【" +levelcode[ist_parm.int4]+"】"
tv_new.data = string(ist_parm.int3)

new_handle=tv_1.InsertItemlast(al_handle,tv_new)
else
//如果没有子节点
tv_cur.Children=true
tv_1.SetItem(al_handle,tv_cur)
end if
end if
end if
//
//
// //ClassicGSMType
// //messagebox("","1")
end if
gs_closetype = ls_closetype

return 0
jimwoo 2009-04-09
  • 打赏
  • 举报
回复
在ExpandItem里有没有写,或者其他地方
guotangyu 2009-04-09
  • 打赏
  • 举报
回复
就是这句tv_1.insertitemlast(ii_handle,ltvi_new)
加上它会一下增加两个节点,不加就一个也不显示了。但是数据库中是对的呢。只增加了一条数据
guotangyu 2009-04-09
  • 打赏
  • 举报
回复
if tv_1.getitem(ii_handle,tv_item) = -1 then return
tv_item.label = ls_mess
select max(to_number(treeid)) into :ls_treeid from bm_bqbmb0_tree ;
ll_treeid=long(ls_treeid)+1
ls_parentid=string(tv_item.data)
ls_treeid=string(ll_treeid)
insert into bm_bqbmb0_tree(treeid,treename,parentid)
values(:ls_treeid,:ls_mess,:ls_parentid);
if sqlca.sqlcode<>0 then
messagebox("提示","生成数据失败!"+sqlca.sqlerrtext)
return
else
commit;
ltvi_new.label = ls_mess
ltvi_new.data = ls_treeid
ltvi_new.children = false
// tv_1.insertitemlast(ii_handle,ltvi_new)
tv_1.expanditem(ii_handle)
messagebox("提示","新增病情编码成功!")
end if
zhgwbzhd 2009-04-09
  • 打赏
  • 举报
回复
你还是看看你的代码吧。

应该是没问题的。

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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