PowerBuilder窗口中的结构体怎么使用

PowerBuilder窗口中的结构体怎么使用... PowerBuilder窗口中的结构体怎么使用 展开
 我来答
miaojoy1314
推荐于2018-04-13 · TA获得超过229个赞
知道小有建树答主
回答量:193
采纳率:0%
帮助的人:160万
展开全部
结构体你应该懂得的,结构体是一种复杂的数据类型,就像数组一样,但是比数组复杂的多,它的主要区别是,一个结构体中可以定义多种不同的数据类型,同样的你可以在PB中应用结构体来定义一些变量(类似于窗口中的字段),可以使整型,也可以是数组,也可以是控件,窗口等等。要是想使用在程序中先定义,然后就可以使用这个结构体当中的一些变量了,比如:在程序中定义了一个结构体str_structure,在其中被定义了一个变量as_test,那么如果想在程序中使用这个变量,可以写
string ls_test
str_structure lstr_structure
ls_test = lstr_structure.as_texst
messagebox('ls_test ' , ls_test )
下面是PB中的英文资料,你可以看一下,不过极少使用这个的,我们公司的程序中只使用不到三个结构体,一般的方法已经能满足需要。
General information
A structure is a collection of one or more variables (sometimes called elements) that you want to group together under a single name. The variables can have any data type, including standard and object data types and other structures.
Defining structures
When you define a structure in the Structure painter or an object painter (such as Window, Menu, or User Object), you are creating a structure definition. To use the structure, you must declare it. When you declare it, an instance of it is automatically created for you. When it goes out of scope, the structure is destroyed.

For details about defining structures, see the PowerBuilder User's Guide.
Declaring structures
If you have defined a global structure in the Structure painter called str_emp_data, you can declare an instance of the structure in a script or in an object's instance variables. If you define the structure in an object painter, you can only declare instances of the structure in the object's instance variables and scripts.
This declaration declares two instances of the structure str_emp_data:

str_emp_data str_emp1, str_emp2

Referring to structure variables
In scripts, you refer to the structure's variables using dot notation:

structurename.variable

These statements assign values to the variables in str_emp_data:

str_emp1.emp_id = 100

str_emp1.emp_lname = "Jones"
str_emp1.emp_salary = 200
str_emp2.emp_id = 101
str_emp2.emp_salary = str_emp1.salary * 1.05

Using structures as instance variables
If the structure is declared as part of an object, you can qualify the structure name using dot notation:

objectname.structurename.variable

Suppose that this declaration is an instance variable of the window w_customer:

str_cust_data str_cust1

This statement in a script for the object refers to a variable of str_cust_data (the pronoun This is optional, because the structure declaration is part of the object):

This.str_cust1.name

This statement in a script for some other object qualifies the structure with the window name:

w_customer.str_cust1.name
网易云信
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同... 点击进入详情页
本回答由网易云信提供
yuerpb
2011-01-07
知道答主
回答量:27
采纳率:0%
帮助的人:19.1万
展开全部
窗口结构体是说窗口中定义的结构体吧,只能被窗口引用,相当个针对窗口的一个实例变量。窗口结构体定义方法:
编辑环境下打开一个窗体后,在view菜单→sturcture中添加即可
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
shihaotian601
2010-12-31 · TA获得超过209个赞
知道小有建树答主
回答量:191
采纳率:0%
帮助的人:133万
展开全部
窗口中没有结构体吧~
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
13708248
2010-12-30 · TA获得超过121个赞
知道小有建树答主
回答量:303
采纳率:0%
帮助的人:196万
展开全部
什么叫窗口中的结构体?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式