Hi ,
i define a class containing an event definition.
I can fire the event from the call but there is a crash when event return
all works fine in previous version of RB (i don't check this plugin since two
or three years)
does somebody have an idea ?
/*******
/* here is the event definition
REALevent WTClassEvents[] = {
{ "WT_Event(infos as string)" },
} ;
static void EnableWTClassEvents(REALobject instance, RBboolean param)
{
ClassData (WTClass, instance, WTClassData, me);
if (param == true) {
me->instance = instance ;
} else {
me->instance = nil ;
}
}
/***
/* Here the event class definition
REALclassDefinition WTClass = {
kCurrentREALControlVersion, "DWTClass", nil, sizeof(WTClassData), 0,
(REALproc) WTClassConstructor, (REALproc) WTClassDestructor,
WTClassProperties, sizeof(WTClassProperties) /
sizeof(REALproperty),
WTClassMethods, sizeof(WTClassMethods) /
sizeof(REALmethodDefinition),
WTClassEvents, sizeof(WTClassEvents) / sizeof(REALevent),
NULL , 0, // Event instances
NULL , // Interfaces
NULL , 0, // Bind descriptions
NULL , 0 // Constants
};
/***
/* Here is the call event routine
#include "main.h"
extern REALclassDefinition WTClass ;
extern REALevent WTClassEvents[] ;
// WARNING - ATTENTION
// DSPClassEvents[0] point to "DSP_Event(code as integer, value as double,
infos as string)"
// DSPClassEvents[1] point to "DSP_DebugEvent(infos as string)"
//
// Evenement applicatif
void WT_Event(WTClassData *me, char *infos)
{
void (*fp)(REALobject instance, REALstring) ;
REALstring theString ;
if(me->instance) {
theString = REALBuildString(infos, strlen(infos)) ;
fp = (void (*)(REALobject, REALstring))
REALGetEventInstance((REALcontrolInstance) me->instance, &WTClassEvents[0]) ;
if (fp) fp(me->instance, theString) ; else WTMessage("fp =
nil") ;
}
}
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>