请教动态添加菜单的问题

cwel 2017-10-27 06:39:18
如下代码添加一级菜单没问题:
menu m_temp
integer li_count

m_temp = create m_new
li_count = upperbound(m_genapp_main.item[])
m_genapp_main.item[li_count + 1] = m_temp
m_genapp_main.item[li_count + 1].text = "新菜单"
m_genapp_main.item[li_count + 1].tag = "001"

m_genapp_main.item[1].hide()
m_genapp_main.item[1].show()
destroy m_temp

在此基础上,再添加一个二级菜单,pb就崩了,什么问题?
menu m_temp
integer li_count,li_count1

m_temp = create m_new
li_count = upperbound(m_genapp_main.item[])
m_genapp_main.item[li_count + 1] = m_temp
m_genapp_main.item[li_count + 1].text = "新菜单"
m_genapp_main.item[li_count + 1].tag = "001"

li_count1 = upperbound(m_genapp_main.item[li_count+1].item[])
m_genapp_main.item[li_count+1].item[li_count1+1] = m_temp
m_genapp_main.item[li_count+1].item[li_count1+1].text = "新菜单1"
m_genapp_main.item[li_count+1].item[li_count1+1].tag = "0001"

m_genapp_main.item[1].hide()
m_genapp_main.item[1].show()

destroy m_temp

谢谢帮助!!!
...全文
520 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaozhe_song 2017-10-27
  • 打赏
  • 举报
回复
重新再用一个新的菜单变量初始化,别用之前一级菜单那个~

740

社区成员

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

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