当前位置: 代码迷 >> PB >> OpenTabWithParm函数的用法,该怎么解决
  详细解决方案

OpenTabWithParm函数的用法,该怎么解决

热度:121   发布时间:2016-04-29 10:28:06.0
OpenTabWithParm函数的用法
tab_1.OpenTabWithParm(lu_bill,ls_seq,is_BillObject,i)
谁能帮我详细说明一下这个函数的用法吗?

------解决方案--------------------
tabcontrolname.OpenTabWithParm ( userobjectvar, parameter, index )

Argument Description
tabcontrolname The name of the Tab control in which you want to open the user object as a tab page.
userobjectvar The name of the custom visual user object you want to open as a tab page. You can specify a custom visual user object defined in the User Object painter (which is a user object datatype) or a variable of the desired user object datatype. OpenTabWithParm places a reference to the opened custom visual user object in userobjectvar.
parameter The parameter you want to store in the Message object when the user object is opened. Parameter must have one of these datatypes:?String?Numeric?PowerObject
index The number of the tab before which you want to insert the new tab. If index is 0 or greater than the number of tabs, the tab page is inserted at the end.
Return value 

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, OpenTabWithParm returns null.

Usage 

The system Message object has three properties for storing data. Depending on the datatype of the parameter specified for OpenTabWithParm, scripts for the opened user object would check one of the following properties.

Message object property Argument datatype
message.DoubleParm Numeric
message.PowerObjectParm PowerObject (PowerBuilder objects, including user-defined structures)
message.StringParm String

Examples:
This statement opens an instance of a user object named u_Employee as a tab page in the Tab control tab_empsettings. It also stores the string James Newton in Message.StringParm. The Constructor event script for the user object uses the string parameter as the text of a StaticText control st_empname in the object. The script that opens the tab page has the following statement:

tab_empsettings.OpenTabWithParm(u_Employee, &

"James Newton", 0)

The user object's Constructor event script has the following statement:

st_empname.Text = Message.StringParm

The following statements open an instance of a user object u_to_open as the first tab page in the Tab control tab_empsettings and store a number in message.DoubleParm. The last statement selects the tab page:

u_employee u_to_open

integer age = 50

tab_1.OpenTabWithParm(u_to_open, age, 1)

tab_1.SelectTab(u_to_open)

------解决方案--------------------
OpenTabWithParm

功能:将指定的用户对象作为标签页打开,此后用户对象的属性可能通过程序访问,同时进行参数传递,将参数保存在message系统对象中。

你用的是第二种语法格式

打开设计应用程序时未知数据类型的定制用户对象作为标签页,该定制用户对象的数据类型在程序运行时确定
tabcontrolnmae.opentabwithparm(userojbectvar,parameter,userobjecttype,index)

参数:
tabcontrolname:标签控件名

userobjectvar:dragobject数据类型的变更。打开用户对象后,opentab()函数将把该用户对象的引用 放置在参数userobjectvar中。
parameter:指定用户对象打开时要传递的参数,该参数将保存在Message系统对象中。parameter参数的数据类型必须是下述三种之一:string,numeric,powerobject
userobjecttype:string类型 ,其值指定要打开用户对象的数据类型,该类型必须是userobjectvar参数的后继类
index:标签页索引,指定新打开的标签页要插入在哪个标签页的前面。该参数的值为0或大于标签总数,那么新的标签页将被插入至尾部
返回值
integer 函数执行成功时返回1,发生错误时返回-1.如果任何参数的值为Null,返回Null
  相关解决方案