When I create the first instance it's ok. But when in the main I try to create a second instance I get this error:package Page; sub new { my ($class,%args) = @_; my $self = Tie::SecureHash->new($class); my $s = Default::Style->new(); $self->{"Page::filename"}=$args{filename} || croak __"Manca il fil +ename (obbligatorio)"; $self->{"Page::name"}=basename($args{filename}); $self->{"Page::style"}=$args{style} || "editor"; $self->{"Page::scrolled"}=Gtk2::ScrolledWindow->new (undef, undef) +; $self->{"Page::sourceview"}=Gtk2::SourceView2::View->new(); $self->{"Page::lm"}=Gtk2::SourceView2::LanguageManager->new(); $self->{"Page::sm"}=Gtk2::SourceView2::StyleSchemeManager->new(); $self->{"Page::buffer"}=$self->{sourceview}->get_buffer(); $self->{"Page::label"}=Gtk2::HBox->new($s->get_box_new_small); $self->{"Page::title"}=Gtk2::Label->new($self->get_name); $self->{"Page::button"}=Gtk2::Button->new(); $self->init(); return $self; } sub init{ my $self = shift; my $a = Default::Actions->new(); my $s = Default::Style->new(); $self->{scrolled}->add($self->get_sourceview); $self->{title}->set_tooltip_text($self->{name}); ... ... .. }
I think this is because of the blessing class is the same ... but the question is: How can I instantiate multiple instance of my class? Thank you!Gtk-WARNING **: Attempting to add a widget with type GtkSourceView to +a container of type GtkScrolledWindow, but the widget is already insi +de a container of type GtkScrolledWindow
In reply to Problem with Class and AUTOLOAD with GTK by kapello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |