Alfred, thanks for the pointers and the advice and the comments from Joe at
Real.
Its not really a big deal as I do have another route I can use which is
native IPC or I could use the socket functions in the api as well
off to do some more playing .

Its a shame I cannot pull off the events from the IPCSocket but not a major
issue. There are lots of solutions I can use for IPC.


Thanks Again guy's
Mark



                                                                            
                                                                            
                                                                            
   Re: Built In Class Events                                                
                                                                            
                                                                            
   Alfred Van Hoek                                                          
                   to:                                                      
                     REALbasic Plugins                                      
                                                           08/04/2011 13:21 
                                                                            
                                                                            
                                                                            
                                                                            
   Sent by:                                                                 
         [email protected]                   
  Please respond to REALbasic Plugins                                       
                                                                            
                                                                            
                                                                            






First,
when using REALeventInstance, you will need to make sure that your class
inherits from the socket:

REALclassDefinition EcholinkClassDefinition =
{
kCurrentREALControlVersion,
         // Version
"iQSO",
                       // Name
"IPCSocket"
                                       // Super

then

void DataAvailableActionCode(REALobject instance){
 printf("HELLO");
}

REALeventInstance                EcholinkClassEventInstances[] = {
{ "DataAvailable", (REALproc) DataAvailableActionCode }
};

This way your DataAvailableActionCode gets called. ALso note that you don't
need to use Dynamic access to instantiate the socket, because in the RB
runtime you can simply do new IQSO.

My guess though is that you don't want to use this avenue, and there is no
official API to install an eventhandler on the IPCSocket. Not sure though
if you can use a dynamic access call to AddHandler, which was introduced
recently. I haven't tried that avenue. Perhaps someone at REAL could shed
some light if AddHandler(REALobject) with the "DataAvailable" signature can
by successfully accessed...


On Apr 8, 2011, at 8:12 AM, [email protected] wrote:

>
> Guy's
>          I have an issue I am fighting with and perhaps someone can help
> me with.
> I am using an in-built class that I want to chat between two separate
> processes. My IPCSocket is working but I want to implement
> the Data Available Event within my plugin code for IPCSocket.
>
> I have placed the call into the plugin entry to get the reference.
>
> void PluginEntry( void )
> {
>                mICPSocket = REALGetClassRef("IPCSocket");
>                SetClassConsoleSafe( &EcholinkClassDefinition );
>                REALRegisterClass( &EcholinkClassDefinition );
> }
>
> Instantiate the IPCSocket
> me->mIPCObj = REALnewInstance(mICPSocket );
>
>                // Now we have the object bin it and put it into receive mode
>                // we need to define the receive event and work with this
perhaps higher
> up in the object
>                // If We have an invlaid object then the next calls will fail
>
>                if (me->mIPCObj){
>       //Blagh Blagh - Connect and or listen
>      }
>
> I have defined the events I want to implement.
>
> REALclassDefinition EcholinkClassDefinition =
> {
> kCurrentREALControlVersion,
         // Version
> "iQSO",
                       // Name
> nil,
                                       // Super
> sizeof( EcholinkClassData ),
                 // Data Struct Size
> 0,
                                         // Reserved Always Zero 0
> (REALproc)EcholinkClassInitializer,
         // Initialiser
> (REALproc)EcholinkClassFinalizer,
 // Deinitialiser
> EcholinkClassProperties,
         // Property List
> _countof( EcholinkClassProperties ),                                          
>  //
Property Count
> EcholinkClassMethods,
       // Methods
> _countof( EcholinkClassMethods ),
 // Method Count
> EcholinkClassEvents,
       // Events
> _countof( EcholinkClassEvents ),
 // Event Count
>
> // Here are the Event(s) I wish to implement
> EcholinkClassEventInstances,
                 // Event Instances
> _countof(EcholinkClassEventInstances),                                        
>          //
Event Instance Count
> // End of the Events I wish to implement
>
> "",
                               // Interfaces
> nil,
                                                 // Obsolete 1
> 0,
                                         // Obsolete 2
> EcholinkClassConstants,
                         // Constants
> _countof( EcholinkClassConstants ),
         // Number Of Constants
> 0,
                               // mFlags
> EcholinkClassSharedProperties,
 // Shared Properties
> _countof( EcholinkClassSharedProperties ),                   // Shared 
> Properties
Count
> EcholinkClassSharedMethods,
         // Shared Method Struct
> _countof( EcholinkClassSharedMethods ),                                       
>          //
Property Count
> };
>
>
> Then I build up the structure of the events I wish to implement.
>
>
> REALeventInstance              EcholinkClassEventInstances[] = {
> { "DataAvailable()", }
> };
>
> And then
>
> void DataAvailableActionCode(REALobject instance){
>  printf("HELLO");
> }
>
>
> REALeventInstance DataAvailableEventInstance =
> { "DataAvailable", (REALproc)DataAvailableActionCode };
>
>
> How to i Target the IPC Socket as delivering the data available event !!
>
> Do I use
>
> (void (*)(REALobject))REALGetEventInstance( (REALcontrolInstance)mIPCObj,
> &EcholinkClassEventInstances[0]);
>
> How then do I implement the event in my c / C++ code ie point the event
> recovered from IPC socket at my own function.
>
>
> In my example the event does not fire !! In my clas init routine do I
need
> to point the event at the code I with to run.
>
> I have defined my events no problem but I am strugging with defining and
> implementing the Events for the IPCSocket.
>
>
> Can anyone help me please
> Mark
>
>
>
>
>
>
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

- Alfred Van Hoek
[email protected]
http://web.mac.com/vanhoek



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to