社区
PowerBuilder
帖子详情
pb中如何动态创建菜单?
jqka007
2003-08-19 02:17:47
在pb中,想通过查询数据库的相关记录动态创建菜单,应该如何实现,请高手指点
...全文
73
1
打赏
收藏
pb中如何动态创建菜单?
在pb中,想通过查询数据库的相关记录动态创建菜单,应该如何实现,请高手指点
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
chrisfy
2003-08-19
打赏
举报
回复
看看已有菜单的Edit source
动态创建
与读取
菜单
源码
PB
动态创建
菜单
........
PB
动态创建
菜单
........
pb
动态生成
菜单
.txt
在
PB
帮助的MENU OBJECT一节当
中
,关于其PROPERTIES描述当
中
有一项: Item[ ] Menu Specifies the Menu objects under a Menu object. 这看似简单的一句话其实包含了三层含义: 1、这句话说明MENU对象有一个属性为数组类型,它其
中
的各个元素记录了其所有的具体子ITEM项目,可以借助这个数组
中
各元素来访问底层的各子
菜单
; 2、这些子ITEM项目仍是MENU类型,因此可以按照第一点的逻辑继续向下层推广,借助该子ITEM的ITEM[]属性可以进而访问其所属下层的第二层子
菜单
,推而广之,即可全面遍历整个
菜单
体系的所有子
菜单
项目; 3、既然该属性是一个数组类型,那么就可以按照数组类型变量来处理,我们可以对其进行upperbound()、lowerbound()等函数操作,还可以进行数组的扩展,即添加新项目,这一点很重要,它是我们整篇文章的核心,如何利用
PB
实现动态添加
菜单
,说白了就是添加这个数组元素(读者必须对此有一个清晰的认识),同时期间有一些配套具体的实现技巧,详见下文。
pb
8
动态创建
树和
菜单
,
pb
遍历生成
菜单
,树
pb
8源码,
动态创建
树和
菜单
,及对树和
菜单
的增、删、改 效果图:http://album.hi.csdn.net/app_uploads/liubocy/20081117/021309093.p.jpg?d=20081117021615546 请注释掉tv控件的selectchanged事件代码.
动态创建
菜单
、树
pb
动态创建
树和
菜单
forward global type w_tv from window end type type cb_2 from commandbutton within w_tv end type type cb_1 from commandbutton within w_tv end type type sle_1 from singlelineedit within w_tv end type type st_1 from statictext within w_tv end type end forward global type w_tv from window integer width = 1381 integer height = 620 boolean titlebar = true string title = "Untitled" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_2 cb_2 cb_1 cb_1 sle_1 sle_1 st_1 st_1 end type global w_tv w_tv on w_tv.create this.cb_2=create cb_2 this.cb_1=create cb_1 this.sle_1=create sle_1 this.st_1=create st_1 this.Control[]={this.cb_2,& this.cb_1,& this.sle_1,& this.st_1} end on on w_tv.destroy destroy(this.cb_2) destroy(this.cb_1) destroy(this.sle_1) destroy(this.st_1) end on event open;String ls_Parm, ls_temp, ls_Name, ls_title ls_Parm = Trim( Message.StringParm ) ls_temp = Right( ls_Parm, 1 ) ls_Name = Left( ls_Parm, Lenw( ls_Parm ) - 2 ) IF ls_temp = 'T' THEN ls_title = '添加 ' + ls_Name + ' 的同类' END IF IF ls_temp = 'Z' THEN ls_title = '添加 ' + ls_Name + ' 的子类' END IF IF ls_temp = 'M' THEN ls_title = '修改 ' Sle_1.text = ls_Name Sle_1.SelectText( 1, Len( ls_Name ) ) END IF title = ls_title end event type cb_2 from commandbutton within w_tv integer x = 727 integer y = 360 integer width = 457 integer height = 128 integer taborder = 20 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "退出(&E)" boolean cancel = true end type event clicked;CloseWithReturn( Parent, '' ) end event type cb_1 from commandbutton within w_tv integer x = 165 integer y = 360 integer width = 457 integer height = 128 integer taborder = 30 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "确定(&O)" boolean default = true end type event clicked;String ls_Name ls_Name = Trim( sle_1.text ) CloseWithReturn( Parent, ls_Name ) end event type sle_1 from singlelineedit within w_tv integer x = 64 integer y = 156 integer width = 1234 integer height = 128 integer taborder = 10 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_1 from statictext within w_tv integer x = 64 integer y = 40 integer width = 457 integer height = 72 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "类别名称" boolean focusrectangle = false end type
PB
编程技巧100例(CHM)
PB
编程技巧100例(CHM) Table (20)
PB
修改数据库表结构的技巧 李清 System (19)用
PB
5设计串口通讯程序 王学军 TreeView (18)在
PB
的TreeView控件
中
实现自动查询 周剑峰 Datawindow (17)PowerBuilder数据窗口编程技巧十则 蔡伟龙 System (16)如何在POWER BUILDER
中
使用WINSOCK控件 达伟春 OTHER (15)在
PB
打印
中
实现人民币大写 侯晓伟 MENU (14)用
PB
做一个通用右键
菜单
田俊国 SQL (13)SQL基础 System (12)用PowerBuilder开发多媒体播放器 河北 黄万璞 控件 (11)
动态创建
可视控件的基本方法 鹿寒 WEB (10) 用PowerBuilder创建Internet应用 Sybase 软件(北京)有限公司 霍军 SQL (9)同时访问多个数据库 大庆石化总厂信息
中
心 (邮编163714) 李畅 System (8)如何在
PB
中
使用OCX控件? 陶清网站 Datawindow (7)美化DataWindow的显示效果 程序
中
心
PB
站 Datawindow (6)当Retrieve时不清除原有Datawindow数据 程序
中
心
PB
站 Datawindow (5)当表(Table)的定义发生改变以后同步DataWindow columns 程序
中
心
PB
站 Datawindow (4)在表格(Grid)风格的DataWindow放入标题 程序
中
心
PB
站 Datawindow (3)使用Line建立漂亮的Grid DataWindow的技巧 程序
中
心
PB
站 System (2)使Sybase SQL Anywhere的启动窗口不出现在任务栏 程序
中
心
PB
站 SQL (1)使用SQL产生BCP命令快速备份/恢复你所有数据 (仅用于Sybase和MS SQL Server数据库) 程序
中
心
PB
站
PowerBuilder
1,077
社区成员
66,438
社区内容
发帖
与我相关
我的任务
PowerBuilder
PowerBuilder 相关问题讨论
复制链接
扫一扫
分享
社区描述
PowerBuilder 相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章