swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to catch a controPanel Quit?


From: Rick Riolo
Subject: how to catch a controPanel Quit?
Date: Thu, 8 Jul 1999 08:05:49 -0400 (EDT)

Here is something I just tried to do:

In the usual ObserverSwarm.m buildObjects (eg in heatbugs),
after the initial widgets and control panel are put on the screen,
we get to something like:

  [controlPanel setStateStopped] ;

waiting for the user to change parameter values, and press
Start, Next, or whatever.

I wanted to catch a Quit right after that, before building
model objects (because I throw them on the screen right away,
and Stop the model again, before doing any actual model steps), 
so I added this right after the above:

  fprintf(stderr,"cp state %d, ControlStateQuit is %d.\n",
                  [controlPanel getState], ControlStateQuit );

  if ( [controlPanel getState] == ControlStateQuit )
          return self;

But that didn't catch the quit, it just went on
(to build model objects, etc). The values printed are:

   cp state 135337400, ControlStateQuit is 135315544.

Also, if I then press Quit again, it quits, but if I then
press Next, it core dumps with:

*** event raised for error: SourceMessage
*** function: auditRunRequest(), file:
/usr/local/swarm/Swarm-1.4.1/swarm-1.4.1/src/activity/XActivity.m, line:
52
> cannot next an activity that is already completed
*** execution terminating due to error

Clearly I am missing something about how this should work.
The ControlPanel ref manual page doesn't help (me).

So...my question is, can I catch a Quit after that first panel
comes up, before doing any object building, etc?

thanks.
 - r

Rick Riolo                           address@hidden
Center for Study of Complex Systems (CSCS)
4477 Randall Lab                
University of Michigan         Ann Arbor MI 48109-1120
Phone: 734 763 3323                  Fax: 734 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]