From: Alex G. <ale...@ne...> - 2009-11-09 15:44:07
|
Fabrizio Pollastri kirjoitti: > Alex Grönholm wrote: > >> Fabrizio Pollastri kirjoitti: >> >>> Alex Grönholm wrote: >>> >>>> Fabrizio Pollastri kirjoitti: >>>> >>>>> Hi all, >>>>> when the gui of my application is closed or when the application >>>>> destroys (intentionally) part of the gui, I need to catch this event >>>>> for each involved widget. Any suggestion is welcome. Thanks in advance. >>>>> >>>>> >>>>> >>>> What for? Also, I don't think any dispose events are sent, but you >>>> can catch events generated from removing those widgets from their >>>> parent container. >>>> Would that be good enough? >>>> >>> I have tried this: >>> >>> widget.addContainerListener(ContainerListener(my_destroy_manager_function)) >>> >>> .... >>> class ContainerListener(awt.event.ContainerListener): >>> "Call my widget destroy handler" >>> >>> def __init__(self,my_destroy_manager): >>> self.my_destroy_manager = my_destroy_manager >>> >>> def componentRemoved(self,*args): >>> self.my_destroy_manager() >>> >>> But nor the closing by mouse clicking, nor the widget dispose method >>> trigger my_destroy_manager function. >>> >>> >> Because in neither case is your component actually removed from its >> parent container. Please explain why you need to do this in the first >> place so we may help you. >> > > I am porting AVC (http://avc.inrim.it) to java swing using jython. > > In brief, AVC is a python module that connects values displayed by > widgets to values held by application variables. The connection is done > automatically matching names assigned to widgets with variable names. > Sounds just like what I've been doing with the binding module in jython-swingutils (http://bitbucket.org/agronholm/jython-swingutils/). Why don't you take a look and see if it's anything like AVC? > When a widget controlled by AVC is destroyed, AVC needs to remove it > from its internal data structures. So I am looking for the right signal > to do this when I close the main window or the program delete same > widgets from the gui. > It is relatively rare for widgets to actually get removed from their parent container in Swing applications. Are these internal data structures persistent? If not, I see no point in removing the variables from them on application exit. If they are, you could just listen for the parent window's windowClosed event. > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |