On Wed, 27 Aug 2003, Saber ZRELLI wrote:

>
> Hi all ,
>
>
> The problem is as follows :
>
>
> i have several communication sockets , to each socket i attach a costumised
> output window ( which is a perl object i've created ) .
> and i store all the output windows in a hash called WIN_LIST , this is the
> code snippet :
>
> >>>
> $WIN_LIST{$sock}=new perl_modules::out_put_window();
> <<<
>
> then i attach a function to the event destroy of each output window (
> when i close the putput window i want perl to call a certain function )
> this is the snippet :
>
> >>>
> $WIN_LIST{$sock}->display->bind ('<Destroy>' => \&remove_window);
> <<<
>
> and this is the code of remove_window function :
>
>
> >>>
> sub remove_window {
>
> print " trying to remove $Tk::widget \n";
> foreach $k (keys %WIN_LIST)
> {
>         if ( $WIN_LIST{$k} == $Tk::widget )
>         {
>                 delete $WIN_LIST{$k};
>                 $s->remove($SOCK_LIST{$k});
>                 delete $SOCK_LIST{$k};
>                 print " $Tk::widget Found in Hash and deleted \n";
>
>
>         }
> }
>
>
> }
>
> <<<
>
> what i have noticed  is :
>
> the   $Tk::widget have this format :
> while $WIN_LIST{$k} have this one  :
>
> what i want to know , is how can i obtain the $WIN_LIST{$k} like format in
> the remove_window function.
> i tried to send the $WIN_LIST{$k} as a parameter in the callback
> specification , but that caused instant call to the call back ( not caused
> by the destroy event ).
>

If you want to handle each socket as it is closed then you need to
create a custom DESTROY method for the object. If you simply
want to release all win_list objects at the time you exit your
script then code in an END block could perform this function.

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to