class properties as raw

Posted by Blake Stanford on 17-Jul-2018 16:08

I have defined a class property as a raw value, however I cannot get the property set.  Here is what I have:

Class TestRawProp:

define private property rHexCode as raw
get.
set.

constructor public TestRawProp:

def var rTemp as raw.

put-string(rTemp,1) = "Test".

TestRawProp:rHexCode = rTemp.

rTemp = "".

rTemp = TestRawProp:rHexCode().

message get-string(rTemp,1) view-as alert-box.

end constructor.

end class.

The message statement shows the unknown value.  Any help would be appreciated.

All Replies

Posted by Dileep Dasa on 18-Jul-2018 02:41

I tried running this code but ended up in multiple errors (CONSTRUCTOR missing parentheses, Unknown field TestRawProp, Incompatible data types in assignment etc). I fixed all these and I get the expected output. Please see the following code. If there is something else you are running, please provide complete ABL code.

Class TestRawProp:

    define private property rHexCode as raw
    get.
    set.
    
    constructor public TestRawProp():
        def var rTemp as raw.
        put-string(rTemp,1) = "Test".
        rHexCode = rTemp.
        PUT-STRING(rTemp,1) = "".
        rTemp = rHexCode.
        message get-string(rTemp,1) view-as alert-box.
    end constructor.
    
end class.


DEFINE VAR trp AS CLASS TestRawProp.

trp = NEW  TestRawProp().

Posted by Simon L. Prinsloo on 18-Jul-2018 04:36

Something is wrong with your example and I do not expect it to compile, since you reference rHexCode as if it is a static property (prefixing the class name) instead of an instance property (THIS-OBJECT).

Please fix the example to something that is syntactically correct, so that we can see where your actual problem is.

Posted by Blake Stanford on 18-Jul-2018 07:10

Sorry, the code was a snip.  

This thread is closed