swarm-support
[Top][All Lists]
Advanced

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

Dropping Rasters (and EZGraphs)...


From: mcmullin
Subject: Dropping Rasters (and EZGraphs)...
Date: Sat, 5 Apr 1997 23:03:38 -0700 (MST)

This is an issue I raised some time ago, but am only
getting back to now.  The basic point is that when a
Raster gets dropped the associated tk frame ought to
get dropped too, but isn't.  My hack to fix this is to
add the following to my Raster.m:

  -(void) drop {
    [globalTkInterp eval: "destroy %s", [parent getWidgetName]]; 
    [super drop];
  }

This works fine, but I wondered whether this should not
"properly" go into Widget (from which Raster is
subclassed).

Well, the plot thickened when I recently added an
EZGraph to my app, and encountered exactly the same
problem with it - the associated tk frame was not
getting dropped when the EZGraph was.  Now this frame
"really" belongs to the underlying BLTGraph; and I
found that the EZGraph -drop method does not drop this
BLTGraph - which looks suspiciously like a bug.  So I
tried adding this to the EZGraph -drop, as follows:


  -(void) drop {
    id index, aSequence ;

    [theGraph drop] ;

    index = [sequenceList begin: [self getZone]] ;
    while( (aSequence = [index next]) ){
      [index remove] ;
      [aSequence drop] ;
    }
    [index drop] ;
    [super drop] ;
  }

But, this didn't fix the problem.  I then noted that
BLTGraph is, like Raster, subclassed from Widget, and,
also like Raster, the BLTGraph -drop method did not
apparently drop the associated tk frame...

At this point it definitely did seem that the sensible
thing would be to fix the higher level Widget drop
method so that *it* dropped the tk frame, which would
then be effective for both Raster and BLTGraph objects
(and possibly others which I haven't noticed yet...).

So I tried it ... and it doesn't work.  That is, it
turns out that ProbeDisplay's are also (indirectly)
subclassed from Widget.  They, of course, always have
correctly looked after dropping their associated tk
frames, so it is not suprising (with hindsight) that
there would be some kind of conflict if I tried to put
this in Widget.  In any case, from a *quick* look at
the ProbeDisplay code, it looks like getting rid of the
frame for one of those is rather more complex than for
Raster or BLTGraph objects (though I may be wrong about
this...).

In any case, I have thrown in the towel on this one for
now, and simply given up on the idea of looking after
this frame dropping in Widget, and reverted to doing it
separately in Raster.m (as already shown) and in
BLTGraph.m, augmenting its -drop as follows:

  -(void) drop {
    id index, e;
    index = [elementList begin: [self getZone]];
    while ((e = [index next])) {
      [self destroyElement: e];
    }
    [index drop];
    [globalTkInterp eval: "destroy %s", [parent getWidgetName]]; 
    [super drop];
  }


This seems to work (i.e., dropping a Raster or EZGraph
now gets rid of the corresponding tk frames, and
doesn't *seem* to break anything else) so I shall stick
with it for the moment.  

If anyone else has any more light to shed on this,
please feel free to let me know!  I'd appreciate it if
others could try out these changes also, and let us
know if they break anything in other apps - but failing
reports to that effect, I suggest to Glen that he
consider incorporating these changes to Raster.m,
EZGraph.m and BLTGraph.m in the next official release.


- Regards,

Barry.




-- 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, ALife Group,               |    address@hidden |
| Santa Fe Institute, 1399 Hyde Park Road,   |  Voice: +1-505-984-8800 |
| Santa Fe, NM 87501, USA.                   |  FAX:   +1-505-982-0565 |
| http://www.eeng.dcu.ie/~mcmullin           |                         |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


                  ==================================
   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]