社区
PowerBuilder
帖子详情
新手请教数据窗口添加按钮的代码?
richgod
2007-12-16 04:14:12
新建了一个以GRID形式的数据窗口DW_1,一个窗口WIN1,把DW_1拖放到WIN1中,WIN1中有“添加”按钮,编写添加按钮代码:dw_1.insertrow(0),可是不能编辑,不知道是什么原因?另请教一下保存,修改,及查找按钮该如何写呢?新手刚学,不知道如何下手,多谢了
...全文
536
11
打赏
收藏
新手请教数据窗口添加按钮的代码?
新建了一个以GRID形式的数据窗口DW_1,一个窗口WIN1,把DW_1拖放到WIN1中,WIN1中有“添加”按钮,编写添加按钮代码:dw_1.insertrow(0),可是不能编辑,不知道是什么原因?另请教一下保存,修改,及查找按钮该如何写呢?新手刚学,不知道如何下手,多谢了
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
qq49628637
2011-01-20
打赏
举报
回复
database transaction information not availabla
liaomingyan520
2007-12-18
打赏
举报
回复
connect using sqlca;
if sqlca.sqlcode=0 then
open(w_login)
else
messagebox("prompt!!",sqlca.sqlerrtext)
end if
richgod
2007-12-18
打赏
举报
回复
已经写了,再一次提示“Database transaction information not available,
Call SetTrans or SetTransObject function. ”这样的语句呢?
dawugui
2007-12-17
打赏
举报
回复
没写
dw_1.Settransobject(sqlca)
dw_1.Retrieve()
richgod
2007-12-17
打赏
举报
回复
再一次请教一下,出现“database transaction information not available”这样的提示信息该怎么修改,数据库测试连接成功了啊,
richgod
2007-12-16
打赏
举报
回复
多谢DERSAK的帮助,的确好使
dawugui
2007-12-16
打赏
举报
回复
5、编写用户对象的Constructor事件:
String ls_Syntax
String ls_line
IF This.DataObject = '' Then Return
//创建Footer区
IF Integer(This.Describe("DataWindow.Footer.Height") ) < 120 Then
This.Object.DataWindow.Footer.Height='120'
End IF
//在Footer区添加线
ls_line = 'Create line(band=footer ' + &
'background.mode="2" background.color="16777215"' + &
'pen.style="0" pen.width="5" pen.color="0" x1="0" y1="2" ' + &
'x2="' + String(This.Width - 100) + '" y2="2" )~r~n'
this.modify( ls_line )
//获取设计时的数据窗口语法串
ls_Syntax = This.object.DataWindow.Syntax
//添加按钮语法串
ls_Syntax = uf_addbutton( ls_Syntax )
if this.Create( ls_Syntax ) <> 1 then
MessageBox('提示信息','创建数据窗口出错', StopSign!)
End If
6、从u_dw_button继承就可以了。如下图:
图贴不上来.
dawugui
2007-12-16
打赏
举报
回复
数据窗口中按钮的封装
在数据库的操作中,对数据表记录的检索、添加、删除和保存等操作是最基本和最常用的,可以说这些操作是数据表的标准操作。但PB并没有提供上述封装好的按钮对象,如果每次都要来添加命令按钮并编写脚本,工作是很繁琐的,而且还不能保证界面的一致性。
在PB的数据窗口对象中,可以直接放置按钮对象,而且开发人员既可以给这些按钮制定默认的操作,也可以自己定义按钮的功能。在可以指定的默认操作中就包含了上面提到的所有数据表的基本操作,这样一来在数据窗口需要相应的按钮时,只需要加入按钮对象然后指定其功能就行了。
实际上可以利用PB面向对象的编程技术,实现一个包含标准操作按钮的数据窗口对象,这样在需要用到标准操作的时候,只需要从该对象继承即可满足基本的数据应用需求。
实现过程如下(利用PB9自带数据库,EAS Demo DB V9):
1、建立一个工作空间(workspace),取名为:dwbutton。
2、建立一个应用(application),取名为:dwbutton。
3、建立一个标准的可视用户对象,类型为:datawindow,取名为:u_dw_button。
4、定义用户对象级私有函数uf_addbutton(string as_oldsyntax) return string
//功能:修改数据窗口语法串,为其增加常用功能按钮
//入口参数:as_OldSyntax 原有数据窗口语法串
//返回值: ls_NewSyntax 修改后的语法串
//应用条件:数据窗口中有Footer区, 高度>90的区域是按钮带区
String ls_AddButton
String ls_NewSyntax
Integer li_button_width
Integer li_button_x
//确定Button的位置参数
li_button_width = (This.Width + 20) / 10 - 40
IF li_button_width > 220 Then
li_button_width = 220
li_button_x = (This.Width - 240*10) / 2
IF li_button_x <=0 Then li_button_x = 10
Else
li_button_x = 20
End if
ls_NewSyntax = as_OldSyntax
//---------------添加按钮语法串------------------------------
//检索按钮
ls_AddButton = 'button(band=footer name=cb_retrieve text="检索" ' + &
'enabled=yes action="2" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//首页按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_first text="首页" ' + &
'enabled=yes action="6" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//上页按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_prior text="上页" ' + &
'enabled=yes action="5" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//下页按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_next text="下页" ' + &
'enabled=yes action="4" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//末页按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_last text="末页" ' + &
'enabled=yes action="7" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//添加按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_append text="添加" ' + &
'enabled=yes action="11" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//插入按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_insert text="插入" ' + &
'enabled=yes action="12" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//删除按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_delete text="删除" ' + &
'enabled=yes action="10" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//保存按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_update text="保存" ' + &
'enabled=yes action="13" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
//打印按钮
li_button_x = li_button_x + li_button_width + 20
ls_AddButton = 'button(band=footer name=cb_print text="打印" ' + &
'enabled=yes action="15" border="1" color="8388608" ' + &
'x="' + string(li_button_x) + '" y="20" height="90" ' + &
'width="' + string(li_button_width) + '" ' + &
'vtextalign="0" htextalign="0" visible="1" ' + &
'font.charset="0" font.face="Arial" font.family="2" ' + &
'font.height="-9" font.pitch="2" font.weight="400" ' + &
'background.mode="2" background.color="12639424" )~r~n'
ls_NewSyntax = ls_NewSyntax + ls_AddButton
return ls_newsyntax
I_am_Z
2007-12-16
打赏
举报
回复
在数据窗口的constructor事件中加入语句绑定事务对象sqlca
this.settransobject(sqlca)
richgod
2007-12-16
打赏
举报
回复
Database transaction information not available,
Call SetTrans or SetTransObject function. 出现这样的错误语句怎么修正呢?多谢了
jlwei888
2007-12-16
打赏
举报
回复
这些可最简单的啊!
不能编辑,要看一下DW的Taborder的值,要大于0才能编辑
win1 open事件:
dw_1.settransobject(sqlca)
dw_1.retrieve()
添加:
int i
i = dw_1.insertrow(0)
dw_1.scrolltorow(i)
保存:
dw_1.accepttext()
if dw_1.update() = 1 then
commit;
//成功
else
//失败
rollback;
end if
修改没有用,缺省就是能修改
查找:
参考这个吧:
http://topic.csdn.net/u/20071216/11/720c410e-4dc2-48ec-9f9f-adeb3382e9a3.html
上市企业价值链升级
数据
(2000-2024年)
01、
数据
简介 企业价值链升级是指企业在其业务流程中,通过技术创新、管理改进、品牌建设等多种手段,提升产品和服务的附加值,从而增强市场竞争力和盈利能力的过程。 上市公司价值链升级是一个综合性的过程,涉及多个方面的优化与创新。通过这一过程,企业可以不断提升自身的市场竞争力和盈利能力,实现可持续发展。 计算方法:当期工业增加值=(支付给职工以及为职工支付的现金+应付职工薪酬)+(净利润-营业外收入-投资收益-公允价值变动收益-汇兑收益+营业外支出+资产减值损失)+(营业税金及附加+所得税费用-返还税费)+应付利息;增加值率=增加值/(增加值+购买商品接受劳务支付的现金) 本
数据
包含原始
数据
、参考文献、
代码
do文件和最终结果。
数据
名称:上市公司-价值链升级
数据
数据
年份:2000-2024年 02、相关
数据
证券
代码
证券简称
代码
年份 VC价值链升级 行业
代码
行业名称 所属省份 所属省份
代码
所属城市 所属城市
代码
上市公司工业机器人进口数量2000-2022年
数据
介绍 工业机器人进口申报中依据功能和用途被划入不同HS编码,包括多功能工业机器人,其他工业机器人,专用机器人细分等。主要基于中国海关总署的《中国海关贸易
数据
库》,该
数据
库记录了企业层面的进出口信息,包含产品HS八位编码、贸易金额、数量和价格等关键字段,为精准识别企业进口的工业机器人提供了
数据
基础。通过HS编码归类,可准确界定工业机器人品类并统计其进口情况。
数据
名称:上市公司工业机器人进口数量
数据
年份:2000-2022年 参考文献: Acemoglu,D.and Restrepo,P.,2020,“Robots and Jobs:Evidence from US Labor Markets”,Journal of Political Economy,Vol.128(6),pp.2188~2244.
数据
指标 证券
代码
year 进口机器人总金额(百万元) 进口工业机器人数量
植物大战僵尸素材包,编程学习适用
代码
转载自:https://pan.quark.cn/s/a4b39357ea24 pygame python开发植物大战僵尸游戏用pygame框架 项目具体教程:https://segmentfault.com/a/1190000019418065
STM32CubeMX 用户手册 中文完整版-0398.pdf
【STM32CubeMX 用户手册 中文完整版】 基于官方原版 UM1718 英文手册翻译整理,手册涵盖 STM32CubeMX 从安装、界面操作到工程配置、
代码
生成的全流程,适合 STM32 入门开发者、嵌入式工程师快速上手,是学习和开发 STM32 项目的必备参考文档。
基于动态非合作博弈的大规模电动汽车实时优化调度电动汽车决策研究(Matlab
代码
实现)
基于动态非合作博弈的大规模电动汽车实时优化调度电动汽车决策研究(Matlab
代码
实现)
PowerBuilder
1,108
社区成员
66,453
社区内容
发帖
与我相关
我的任务
PowerBuilder
PowerBuilder 相关问题讨论
复制链接
扫一扫
分享
社区描述
PowerBuilder 相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章