马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
在一个MDI窗口中建一个子窗口,在子窗口上放一个MultiLineEdit 和一个CommandButton,把下面的脚本贴在CommandButton的clicked()事件中,就可以在MultiLineEdit中显示遍历的菜单项了,最大支持八层的菜单,如果你有更多层菜单,只要加大参数的数组上界就可以了。
这个东东主要是用于菜单权限控制。
menu menufx[0 to 8] string menu_name[1 to 8] long i_1[1 to 8] long i_2[1 to 8] int i[1 to 8] int j j=1
menufx[0]=parent.parentwindow().MenuID mle_1.text=mle_1.text+menufx[0].Classname()+menufx[0].text+'~r~n' i_1[j]=LowerBound(menufx[j - 1].Item[]) i_2[j]=UpperBound(menufx[j - 1].Item[]) i[j]=i_1[j] do while true menufx[j]=menufx[j - 1].item[i[j]] menu_name[j]=menufx[j].text if menufx[j].text<>'-' then mle_1.text=mle_1.text+Fill("~t",j - 1)+left(menufx[j].Classname()+' ',10)+menufx[j].text+'~r~n' if i[j]>=i_2[j] then j=j - 1 if j=0 then exit else i_1[j+1]=LowerBound(menufx[j].Item[]) i_2[j+1]=UpperBound(menufx[j].Item[]) i[j+1]=i_1[j+1] if i_1[j+1]=1 and i_2[j+1]=0 then i[j]=i[j]+1 else i[j]=i[j]+1 j=j+1 end if end if loop |