高手请进:关于菜单无限级的问题.txt

tw829 2004-07-29 04:12:04
我定义了一个MENU
BOOT
A
AA
B
BB
C
CC
我在数据库里面建立了一个表:
create table tb_menu(
v_currentid varchar(30) not null,
v_parentid varchar(30) not null,
i_itemstate bit null,
i_level bit null,
v_menutext varchar(100) null,
primey key(v_currentid));

我想在打开主窗体之前就将菜单的的唯一编码,文本读出来,然后存入数据库中,最后再将它们读出,在TreeView中显示出来!
我的问题:我想用递归算法将菜单的是数据读到数据库,但对PB的的一些属性不是很清楚,请高手指教!
我只能做到以下的这种读入方法,但不知道怎样为菜单编一个唯一的ID!
例如:
function wf_dealmenu()
int i,li_c
li_c = upperbound(im_menu.item)
if li_c < 1 or isnull(li_c) then return

string ls_text,ls_id
for i=1 to li_c
ls_id = string(i)
ls_text = im_menu.item[i].text
next
insert into tb_menu v_currentid = :ls_id .....
..........
return

-------------
相信大家应该能明白我的问题所在,请赐教!
在线等待.....................ing.....?
...全文
102 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tw829 2004-09-11
  • 打赏
  • 举报
回复
没办法,只有一个人回答!
tw829 2004-09-11
  • 打赏
  • 举报
回复
呵呵,这个问题我找解决了!
多谢各位支持!
tw829 2004-09-11
  • 打赏
  • 举报
回复
都还不知道还有一个没揭贴,真不好意思!
SilverSands 2004-07-29
  • 打赏
  • 举报
回复
可是想楼主在循环中i那样不唯一么?
SilverSands 2004-07-29
  • 打赏
  • 举报
回复
// Argument: ref am_source The menu should be searched
// as_finditem String containing menu item to be found in menu.
// ref am_menureference The menu of the last menu item in the
// findmenuitem string passed back by reference



// Use recursion to go down the menu item array
li_limit = UpperBound( am_source.Item )
FOR li_cnt = 1 To li_limit
IF ls_SearchItem = Lower( am_source.Item[li_cnt].ClassName() ) THEN
am_MenuReference = am_source.Item[li_cnt]
li_found = 1
ELSE
IF li_found > 0 THEN CONTINUE
li_found = of_GetMenuReference( am_source.Item[li_cnt], as_finditem, am_Menureference )
END IF
NEXT

这一段事 PFC 中用递归查找符合某个特定得值得菜单。

inv_menu.of_GetMenuReference( This.MenuID, 'm_stopdebugservices', im_DebugService )

调用得时候用 This.MenuID 唯一区分菜单

1,079

社区成员

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

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