Re: Dont understand ->owner behaviour for TabbedNotebook

From: Andrew Bramble <andrewb_at_omnilab.com.au>
Date: 04 Dec 2003 12:44:43 +1100
To: prima_at_prima.eu.org

Thanks for the prev. clarification Dimitri.

Attached tabset.fm demonstrating the issue. Notable is that when
attaching pages in the onCreate of the tabbedNotebook, they behave as
expected see attached tabs2.fm

Am I bending the rules too much by letting children insert themselves
into the tabbedNotebook?

AB

On Tue, 2003-12-02 at 14:17, Andrew Bramble wrote:
> I am also seeing a problem attaching ANY object to the tabbed_notebook
> at page 0.
>
> EG: in child onSetup {
>
> my $self = $_[0];
>
> my $tabbed = $self->owner->owner;
>
> $tabbed->attach_to_page( 0 , $self );
>
> }
>
> some-other-child onSetup {
>
> my $self = $_[0];
> my $tabbed = $self->owner->owner;
> $tabbed->attach_to_page( 1 , $self )
>
> }
>
> When executed, the tabbednotebook appears, with tab zero displayed,
> selecting any other tab and returning to tab zero - viola the widget has
> vanished.
>
>
>
>
>
>
>
>
> On Tue, 2003-12-02 at 13:01, Andrew Bramble wrote:
> > Hello,
> >
> > a strange thing I discovered using the visual builder and Prima version
> > 1.12. If setting a child's owner to be a TabbedNotebook object, when
> > calling ->owner from the child I get.
> >
> > in SomeChild
> >
> > print ref $self->owner;
> > print ref $self->owner->owner;
> >
> > "Prima::NoteBook"
> > "Prima::TabbedNoteBook"
> >
> >
> > I believed the tabbed notebook inherited the various methods and props,
> > at the moment I'm trying to encourage widgets to register themselves
> > into the notebook.
> >
> > onCreate {
> > my $self= $shift;
> > my $notebook = $self->owner;
> > my $tabset = $notebook->owner;
> >
> > $notebook->insert_page;
> > $notebook->attach_to_page( 0 , $self );
> >
> > $tabset->set_tabs( @{ $tabset->tabs } , 'This Pagename' );
> >
> > }
> >
> > Feature , bug or has my brain turned to jelly?
> >
> > Thanks
> >
> > AB
> >
> >
>


# VBForm version file=1.2 builder=0.2
# [preload]
sub
{
        return (
        'TabbedNotebook1' => {
                class => 'Prima::TabbedNotebook',
                module => 'Prima::Notebooks',
                extras => {
                Button1 => '0',
                Label1 => '0',
                Label2 => '0',
                },
                actions => {
                onChild => Prima::VB::VBLoader::GO_SUB('$_[2]-> defaultInsertPage( $_[1]-> {extras}-> {$_[3]})
','TabbedNotebook1', 'onChild'),
                onChildCreate => Prima::VB::VBLoader::GO_SUB('$_[3]-> origin( $_[3]->left-$_[3]->owner->left, $_[3]-> bottom-$_[3]->owner->bottom);
','TabbedNotebook1', 'onChildCreate'),
                },
                profile => {
                        tabs => [],
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];

#die ref $self;
','TabbedNotebook1', 'onCreate'),
                        name => 'TabbedNotebook1',
                        owner => 'Form1',
                        origin => [ 50, 50],
                        size => [ 386, 294],
        }},
        'Form1' => {
                class => 'Prima::Window',
                module => 'Prima::Classes',
                parent => 1,
                code => Prima::VB::VBLoader::GO_SUB(''),
                profile => {
                        sizeDontCare => 0,
                        width => 545,
                        name => 'Form1',
                        height => 363,
                        bottom => 60,
                        left => 474,
                        origin => [ 474, 60],
                        size => [ 545, 363],
                        originDontCare => 0,
        }},
        'Label1' => {
                class => 'Prima::Label',
                module => 'Prima::Label',
                siblings => [qw(focusLink)],
                profile => {
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];

my $n = $self->owner;
my $t = $n->owner;
  
$t->set_tabs( @{$t->tabs} , \'Label\' );

my $last = $t->pageCount;

$t->attach_to_page( $last, $self );
','Label1', 'onCreate'),
                        name => 'Label1',
                        owner => 'TabbedNotebook1',
                        origin => [ 42, 46],
                        size => [ 100, 19],
        }},
        'Button1' => {
                class => 'Prima::Button',
                module => 'Prima::Buttons',
                profile => {
                        visible => 1,
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];

my $n = $self->owner ;
my $t = $n->owner;

$t->set_tabs( @{ $t->tabs } , \'Source\' );

my $last = $t->pageCount ;
  
$t->attach_to_page( $last , $self );
','Button1', 'onCreate'),
                        name => 'Button1',
                        owner => 'TabbedNotebook1',
                        origin => [ 38, 74],
                        size => [ 96, 36],
        }},
        'Label2' => {
                class => 'Prima::Label',
                module => 'Prima::Label',
                siblings => [qw(focusLink)],
                profile => {
                        name => 'Label2',
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];

my $n = $self->owner;
my $t = $n->owner;
  
$t->set_tabs( @{ $t->tabs } , \'Second\' );

my $last = $t->pageCount;

$t->attach_to_page( $last, $self );
','Label2', 'onCreate'),
                        owner => 'TabbedNotebook1',
                        origin => [ 154, 62],
                        size => [ 100, 17],
        }},
        );
}


# VBForm version file=1.2 builder=0.2
# [preload]
sub
{
        return (
        'TabbedNotebook1' => {
                class => 'Prima::TabbedNotebook',
                module => 'Prima::Notebooks',
                actions => {
                onChild => Prima::VB::VBLoader::GO_SUB('$_[2]-> defaultInsertPage( $_[1]-> {extras}-> {$_[3]})
','TabbedNotebook1', 'onChild'),
                onChildCreate => Prima::VB::VBLoader::GO_SUB('$_[3]-> origin( $_[3]->left-$_[3]->owner->left, $_[3]-> bottom-$_[3]->owner->bottom);
','TabbedNotebook1', 'onChildCreate'),
                },
                profile => {
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];
                

foreach ( qw/foo blah ack/ ) {

$self->set_tabs( @{$self->tabs} , $_ );
my $foo = Prima::Button->create( owner=>$self );
my $last = $self->pageCount;
$self->attach_to_page($last, $foo);

}
','TabbedNotebook1', 'onCreate'),
                        name => 'TabbedNotebook1',
                        owner => 'Form1',
                        origin => [ 50, 50],
                        size => [ 278, 182],
        }},
        'Form1' => {
                class => 'Prima::Window',
                module => 'Prima::Classes',
                parent => 1,
                code => Prima::VB::VBLoader::GO_SUB(''),
                profile => {
                        sizeDontCare => 0,
                        onCreate => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];
               

','Form1', 'onCreate'),
                        width => 469,
                        name => 'Form1',
                        height => 255,
                        bottom => 85,
                        left => 370,
                        origin => [ 370, 85],
                        size => [ 469, 255],
                        originDontCare => 0,
        }},
        );
}
Received on Thu 04 Dec 2003 - 02:45:28 CET

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:05 CET