Referencing entities in descendants – PB Docs 70

Referencing entities in descendants

When you declare a variable whose data type is a kind of object,
such as a window, you can use the variable to reference any entity
defined in the object, but not in one of its descendants. Consider
the following code:

Mycust is declared as a variable of type w_customer
(mycust is a w_customer window). If w_customer
contains a StaticText control named st_name, then the last
statement shown above is legal.

However, consider the following case:

Here, newwin is defined as a variable of type window. PowerBuilder rejects
the above code because the compiler uses what is called strong
type checking
: the PowerBuilder compiler does not allow
you to reference any entity for an object that is not explicitly
part of the variable’s compile-time
data
type.

Because objects of type window do not contain a st_name
control, the statement is not allowed. You would need to do one
of the following:

  • Change the declaration of
    newwin to be a w_customer (or an ancestor window that also
    contains a st_name control), such as:




  • Define another variable, of type w_customer,
    and assign it to newwin, such as:







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