On Jul 12, 2010, at 2:39 PM, Björn Eiríksson wrote:
On 12.7.2010, at 18:27, Alfred Van Hoek wrote:
On Jul 12, 2010, at 2:03 PM, Björn Eiríksson wrote:
So this whole mess on the MouseDrag change made me think is there
any sanctioned
way for a plugin to wire up a event on a class that it creates or
do I have to go through unsanctioned ways ?
Example case would be if a plugin creates instance of a timer,
then it would want to wire up the timer event.
Not sure, but if you would use the MouseMoveHandler, and you have
set a flag mouseStillDown using MouseDown/mouseUP then you would
have the mousedrag even when the mouse is not moved...
Alfred
Would that not just hang the UI thread ?
Not sure, but setting a flag StillDown should be ok, and mousemove is
firing rapidly, and is supposed to not hang the UI. It is the
mousedown that hangs everything (at least under carbon).
i am able to create a timer and have it fire events. (using
unsanctioned ways to hookup the event since there are just some
things they still have not exposed in the SDK making many things
officially impossible for plugins to be officially sanctioned)
Have another issue though, also relating to the same, if i make a
Timer in Grid1 then I have no good way of knowing which grid owns
that particular timer, in the documentation for timer there seems to
be no data on how to hookup extra data to it, so basically the Grid
has no idea if instance Grid1, Grid2 or Grid3 owns the damn thing.
IEither use a Dictionary to tie your grid with a timer or make a
global list like:
extern REALclassDefinition TaskClass;
typedef struct TaskData
{
X self;
void* guest;
X trakker;
XTimer timer;
void (*_Open)(REALobject);
void (*_Close)(REALobject);
void (*_Run)(REALobject);
long id;
TaskData *prev;
TaskData *next;
Boolean done;
long delay;
Boolean shouldTask;
Boolean inBackground;
Boolean timerHasEventHandler;
BackgroundTaskProc guestProc;
} TaskData;
TaskData* gTaskFirst = NULL;
TaskData* gTaskLast = NULL;
REALobject _FindInstanceFromSubView(REALobject subView)
{
TaskData* rover;
// a null pointer cannot refer to a TaskData*
if (subView == NULL) {
return nil;
}
// search the list and see if it's there
for (rover = gTaskFirst; rover != nil; rover = rover->next) {
if (rover->inBackground)
{
if (subView == rover->self) return rover->self;
}
else
{
if (subView == (REALobject)rover->timer) return
rover->self;
}
}
// if it's not there, return false.
return nil;
}
void Task_Constructor(REALobject instance)
{
ClassData(TaskClass, (REALobject)instance, TaskData, me);
dlog("Task_Constructor ");
me->self = instance;
me->done = true;
me->delay = 10;
me->timerHasEventHandler = false;
me->timer = _CreateInstance(("Timer"));
me->next = nil;
me->prev = nil;
if (gTaskFirst == nil) {
gTaskFirst = gTaskLast = me;
} else {
me->next = gTaskFirst;
gTaskFirst->prev = me;
gTaskFirst = me;
}
}
Alfred
--
______________________________________________________________________
Björn Eiríksson [email protected]
Einhugur Software
http://www.einhugur.com/
______________________________________________________________________
Einhugur Software has sold its products in 57 countries world wide.
______________________________________________________________________
For support: [email protected]
To post on the maillist: [email protected]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>