VLF-One Interface
Posted: Tue Jun 09, 2020 8:34 am
I was wondering if someone could post some sample code on how to create/write an interface. I can't seem to find an example.
Community Forum for Visual LANSA
https://forum.developer.lansa.com/
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_OBJT)
* Define a simple event named MyEvent1 that is signalled with no arguments or parameters
Define_Evt Name(MyEvent1)
* Define a event named MyEvent2 that is signalled with 2 parameters named Name and Address
Define_Evt Name(MyEvent2)
Define_Map For(*INPUT) Class(#STD_ALPHA) Name(#Name)
Define_Map For(*INPUT) Class(#STD_ALPHA) Name(#Address)
* Define a property named TheLastName that is stored in variable #LocalSurname
Define_Com Class(#xsurname) Name(#LocalSurname)
Define_Pty Name(TheLastName) Get(*AUTO #LocalSurname) Set(*AUTO #LocalSurname)
* Define a property named TheAddress that returns a constant value
Define_Pty Name(TheAddress) Get(Get_TheAdress)
Ptyroutine Name(Get_TheAdress)
Define_Map For(*OUTPUT) Class(#STD_ALPHA) Name(#ReturnValue)
#ReturnValue := "121 Smith Street"
Endroutine
* Define a method named MyMethod1 that has no aruments (parameters)
Mthroutine Name(MyMethod1) Access(*PUBLIC)
Signal Event(MyEvent1)
Endroutine
* Define a method named MyMethod1 that has 2 arguemnst called UaseName and UseAddress
Mthroutine Name(MyMethod2) Access(*PUBLIC)
Define_Map For(*INPUT) Class(#STD_ALPHA) Name(#UseName)
Define_Map For(*INPUT) Class(#STD_ALPHA) Name(#UseAddress)
Signal Event(MyEvent2) Name(#UseName) Address(#UseAddress)
Endroutine
End_Com