[Glade-users] multiple istance of glade whit perl



Hi
i'm writing a tool that,when a button is clicked a new glade window is
open, here my code:

sub btnNewMessage_onclick {
 my $newWin = Gtk2::GladeXML->new('gui/wSMS.glade');
 my $newForm = $newWin->get_widget('wSMS');
 $newWin->signal_autoconnect_from_package('callbackSMS');
 $newForm->show;
}

package callbackSMS;
my $ID;
sub init {         #it's on form.show()
 $ID=rand(0,1000);
}

sub btnOk_clicked {
 print $ID;
}

Ok, everytime i click btnNewMessage, a new window appear. but if i
click btnOk, the value of $ID will be the same for all windows!
it seems that every $newWin share the same package "callbackSMS"
there is some way to separate the packages? or using a class?

thx




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