pb没有公开的函数(部分原创+部分转载)

旁注:自己的看法,这并不是"未公布",而是编译器内部使用的方法,因为在dw的某些书写中,编译后在pbd中是用__get_xxx和__set_xxx来替代的。我想这是一种保持接口不变化,保持兼容和移植的需要。而不同版本的__get_xxx和__set_xxx在实现上一定有非常大的不同,参数,使用情景,约定,针对性都不同。或者说,这只是一种分层的方式罢了。例如我们可以对某个属性的读写,写上重载的几十种写法,由编译器酌定使用哪个具体的内部函数。

举例,我们写代码:

dw_1.object.__get_attribute("dept_name",false)
dw_1.object.dept_name[1]
dw_1.object.dept_name[1,1]
dw_1.object.dept_name[1,1,1]
dw_1.object.dept_name(1,1)

反编译直接从pbd中去解析,会发现,结果如下:

parent.dw_1.object.__get_attribute("dept_name",false)
parent.dw_1.object.__get_attribute_item("dept_name",1,1,true)
parent.dw_1.object.__get_attribute_item("dept_name",{1,1},{1,1},true)
parent.dw_1.object.__get_attribute_item("dept_name",{1,1,1},{1,1,1},true)
parent.dw_1.object.dept_name(1,1)

就表明,做实际工作的是下划线开头的函数。联系到面向对象的设计思想:

一些属性被public,而它的左值一般会用set_xxx去执行,而右值会用get_xxx去执行。出于区分,内部使用的我们习惯用下划线,或者双下划线来区分。就是:

_get_xxx,__get_xxx,_set_xxx,__set_xxx。

除以下文章中提到的这些外,还有如:

__create_object

__destroy_object

__get_documentname   (documentname)

__get_name  (name)

__set_imemode  (imemode)

__get_classshortname  (classshortname)

等等。只是某些属性是只读的(readonly),就只有get方法,没有set方法。

而.__get_attribute可以被你写在代码中,是因为它是public的,而__set_imemode不可以被写在代码中,因为它是system-read和system-write的。

要找到这些信息,可以打开pbvm***.dll去搜一下,还有数以百计的类似函数,只不过都是被内部使用的。或者是针对某个对象而写的。

而至某些文字中提到的为什么加下划线,考察发现5.0,6.0之前的是不带下划线的,估计那时该函数刚刚使用,还没考虑到与常规函数的区分以免冲突。

=============================================================================================================

 

来自: http://zhangjinsheng0723.blog.163.com/blog/static/5697145120071113111928799/

已知一个DW中的某列的列名(在字符串变量中),以获得这个列对象的DWO
方法是:

DWObject ldwo_use,ldwo_abc
ldwo_use = dw_1.Object
ldwo_abc = ldwo_use.__get_attribute("name",FALSE)


 非复合报表中的嵌套报表不可使用getchild取得,也不可使用describe取得属性和使用modify更改属性,

你可以调用PB未载入文档的函数来获取/更改属性,请看示例,注意多层嵌套时使用循环获取最终对象.


例:数据窗口控件dw_test包含嵌套报表dw_1,dw_1有栏位dept_name.
dwo b j e c t ldwo_parent,ldwo_obj
string ls_color
ldwo_parent = dw_1.o b j e c t
ldwo_obj = ldwo_parent.__get_attribute("dw_1",false)
ldwo_obj = ldwo_obj.o b j e c t
ldwo_obj = ldwo_obj.__get_attribute("dept_name",false)
ls_color = ldwo_obj.color//取颜色
ldwo_obj.__set_attribute("color",rgb(192,192,192))//更改颜色

__get_attribute()、__get_attribute_item()、__invoke_method()、__set_attribute()、__set_attribute_item()

 

其他参考:http://wenku.baidu.com/view/068b7fd428ea81c758f57814.html

http://blog.csdn.net/vnsoft/article/details/5896740

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值