Powerbuilder - How to create class properties

How to create / define properties for powerbuilder class? I am running PowerBuilder 9 and I am using public variables such as properties, but I want to know how to create / define PowerBuilder properties for an object.

I assume that in PB 9 the variables / properties are very similar in their use and implementation.

+3
source share
2 answers

You mean properties in that, for example, C # or PHP defines them as shells for accessor / mutator methods - something like this (in C #)?

class TimePeriod
{
    private double seconds;

    public double Hours
    {
        get { return seconds / 3600; }
        set { seconds = value * 3600; }
    }
}

EDIT: designated by Hugh Brackett , this can be done using an undocumented keyword INDIRECT.

() - . Powerbuilder :

Powerbuilder accessor / mutator code

( :

global type uo_timeperiod from nonvisualobject
end type
global uo_timeperiod uo_timeperiod

type variables
private double id_seconds
end variables

forward prototypes
public function double of_get_hours ()
public subroutine of_set_hours (double ad_seconds)
end prototypes

public function double of_get_hours ();
return id_seconds / 3600
end function

public subroutine of_set_hours (double ad_seconds);
id_seconds = ad_seconds * 3600
end subroutine

)

+3

indirect. , , PowerBuilder .

+5

Source: https://habr.com/ru/post/1786256/


All Articles