Re: question about expander
- From: "Roderich Schupp" <roderich schupp googlemail com>
- To: "Dimitar Kenanov" <kenanov minet uni-jena de>
- Cc: gtk-perl-list gnome org
- Subject: Re: question about expander
- Date: Mon, 26 Mar 2007 12:05:21 +0200
On 3/26/07, Dimitar Kenanov <kenanov minet uni-jena de> wrote:
i have a question about Gtk2::Expander.
...
I do not know what is happening. What am i doin wrong? Is it really
Short answer: global variables used all over the place.
Slightly longer answer:
sub expand_create_data_form{
($expand_crd,$mess)= _;
if($expand_crd->get_expanded){
$expand_crd->set_label('Hide Create data');
$dframe=(&create_data_form); <===== global
$dframe->show;
$expand_crd->add($dframe);
print "Added $mess\n";
return $expand_crd;
}else{
$expand_crd->set_label('Show Create Data');
$expand_crd->remove($dframe);
print "Removed $mess\n";
return $expand_crd;
}
}
the global $dframe gets assigned the last data_form you created,
e.g. when you expand on tab #1. But then you try to remove the same $dframe
when un-expanding on tab #0 afterward, but it isn't a child of
$expand_crd there.
You somehow have to remember the "correct" $dframe per tab.
Cheers, Roderich
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]