Re: Dont understand ->owner behaviour for TabbedNotebook

From: Dmitry Karasik <dmitry_at_karasik.eu.org>
Date: 02 Dec 2003 16:08:37 +0100
To: prima_at_prima.eu.org

        Hi Andrew!

On 02 Dec 03 at 03:01, "Andrew" (Andrew Bramble) wrote:

 Andrew> Hello, a strange thing I discovered using the visual builder and
 Andrew> Prima version 1.12. If setting a child's owner to be a
 Andrew> TabbedNotebook object, when calling ->owner from the child I get.

 Andrew> in SomeChild

 Andrew> print ref $self->owner; print ref $self->owner->owner;

 Andrew> "Prima::NoteBook" "Prima::TabbedNoteBook"

TabbedNotebook is an immediate parent of TabSet ( these flashy ears )
and Notebook, which is actually responsible for page flipping. Therefore,
all insertions actually go to Notebook. VisualBuilder makes a hackaround,
hiding TabSet and Notebook from you when you move widgets on the form.

 Andrew> I believed the tabbed notebook inherited the various methods and
 Andrew> props, at the moment I'm trying to encourage widgets to register
 Andrew> themselves into the notebook.

Some, but not all - the most important, like attach_to_page or
insert_to_page, are safe to use.

 Andrew> onCreate { my $self= $shift; my $notebook = $self->owner; my
 Andrew> $tabset = $notebook->owner;

 Andrew> $notebook->insert_page; $notebook->attach_to_page( 0 , $self );

 Andrew> $tabset->set_tabs( @{ $tabset->tabs } , 'This Pagename' );

 Andrew> }

 Andrew> Feature , bug or has my brain turned to jelly?

Definitely a feature - check 'podview Prima::Notebooks'.

-- 
Sincerely,
	Dmitry
--- www.karasik.eu.org ---
He who dies with most the toys wins
Received on Tue 02 Dec 2003 - 16:08:42 CET

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