I'm trying to learn how to work with objects in PowerBASIC, and I'm currently trying to learn about event sinks and sources. In the help file, the event example uses a class named EvClass, defined thusly:
Here's my question - does omitting the AS EVENT from the CLASS line in the code above potentially create a problem with the class being able to receive events? I have coded my own class, but used a second interface with the AS EVENT clause, leaving me free to omit it from the main interface, but I also had to omit AS EVENT from the CLASS in order to get it to compile.
So far, my AS EVENT interface is receiving and processing events, but I am wondering what the purpose of AS EVENT on the CLASS line is, if it's not strictly necessary. Am I risking some kind of error or creating a problem if I leave the AS EVENT off of my CLASS definition line? Including it as part of the CLASS definition seems to preclude the use of properties or function-methods throughout all interfaces to be used with the class (whether they are defined AS EVENT or not). Omitting it allows these features on interfaces that are defined without the AS EVENT clause.
Code:
CLASS EvClass AS EVENT INTERFACE EvStatus AS EVENT INHERIT IUNKNOWN METHOD Done MSGBOX "Done!" END METHOD END INTERFACE END CLASS
So far, my AS EVENT interface is receiving and processing events, but I am wondering what the purpose of AS EVENT on the CLASS line is, if it's not strictly necessary. Am I risking some kind of error or creating a problem if I leave the AS EVENT off of my CLASS definition line? Including it as part of the CLASS definition seems to preclude the use of properties or function-methods throughout all interfaces to be used with the class (whether they are defined AS EVENT or not). Omitting it allows these features on interfaces that are defined without the AS EVENT clause.
Comment