Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Referring to tab pages in scripts – PB Docs 125 – PowerBuilder Library

Referring to tab pages in scripts – PB Docs 125

Referring to tab pages in scripts

Dot
notation allows you to refer to individual tab pages and controls
on those tab pages:

  • The window or user
    object containing the Tab control is its parent:

  • The Tab control is the parent of the tab pages contained
    in it:

  • The tab page is the parent of the control contained
    in it:

For example, this statement refers to the PowerTips property
of the Tab control tab_1 within the
window w_display:

This example sets the PowerTipText property of tab page tabpage_1:

This example enables the CommandButton cb_OK on
the tab page tabpage_doit:

Generic coding

You can use the Parent pronoun and GetParent function
to make a script more general.

Parent pronoun

In a script for any tab page, you can use the Parent pronoun to
refer to the Tab control:

GetParent function

If you are in an event script for
a tab page, you can call the GetParent function
to get a reference to the tab page’s parent, which is the Tab
control, and assign the reference to a variable of type Tab.

In an event script for a user object that is used as a tab
page, you can use code like the following to save a reference to
the parent Tab control in an instance variable.

This is the declaration of the instance variable. It can hold
a reference to any Tab control:

This code saves a reference to the tab page’s parent
in the instance variable:

In event scripts for controls on the tab page, you can use GetParent twice
to refer to the tab page user object and its Tab control:

Generic variables for controls have limitations

The type of these variables is the basic PowerBuilder object
type—a variable of type Tab has no knowledge of the tab
pages in a specific Tab control and a variable of type UserObject
has no knowledge of the controls on the tab page.

In this script for a tab page event, a local variable is assigned
a reference to the parent Tab control. You cannot refer to specific
pages in the Tab control because tab_settings does
not know about them. You can call Tab control functions and refer
to Tab control properties:

User object variables

If the tab page is an independent user object, you can define
a variable whose type is that specific user object. You can now
refer to controls defined on the user object, which is the ancestor
of the tab page in the control.

In this script for a Tab control’s event, the index
argument refers to a tab page and is used to get a reference to
a user object from the Control property array. The example assumes
that all the tab pages are derived from the same user object uo_emprpt_page:

note.png The Tab control’s Control property

The Control property array contains references to all the
tab pages in the control, including both embedded and independent
user objects. New tab pages are added to the array when you insert
them in the painter and when you open them in a script.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x