Re: Notebook focus
- From: Philippe Camus <philippe camus in-fusio com>
- To: gtk-perl-list gnome org
- Cc: Ross McFarland <rwmcfa1 neces com>
- Subject: Re: Notebook focus
- Date: 15 Apr 2003 22:03:38 +0200
On Tue, 2003-04-15 at 19:43, Ross McFarland wrote:
i would venture a guess that you're probably getting the last widget b/c
you're using the same var when creating all of the pages and that's just the
last thing it pointed to.
First I would like to thank you all for your replies! Now I'm going to
study them and try to make it work... As for the code I'm using, I've
just re-used the code from the Gtk-Perl tutorial.
Plus I've attached a table to the page, and the text widget is attached
to another table within the first one (to add a scroll-bar as well).
And you're right, I'm using the same var when creating the pages! Now
I'm in for a headache trying to make it work! :)
Thanks a lot!
Best regards,
Phil
Quoting Philippe Camus <philippe camus in-fusio com>:
Hi all,
This is certainly a newbie question, but a "notebook and focus" search in
the mailing list archive didn't give me an interesting answer!
I've appended a bunch of pages to a notebook, and I've created a text
widget with a button on each page.
It's the simplest thing, and here with the button do:
sub ButtonStartClicked
{
$text_log->insert( undef, undef, undef, "foo bar" );
$text_log->thaw();
}
My problem is that whatever button I press (page 1, 2 or 3), the text is
appended to the latest page created.
How can I tell notebook to change the focus to the text widget of a
specific page? I'm looking for something like:
$current_page->$text_log->insert...
If the Gtk::Text widget is the only thing in the page then
$notebook->get_current_page->child->insert(...)
else if there is a Gtk::VBox or Gtk::HBox that holds only one Gtk::Text for
my $child ($notebook->get_current_page->child->children) {
if (ref $child eq 'Gtk::Text') {
$child->insert(...);
}
}
else if there is a Gtk::VBox or Gtk::HBox that holds more than one Gtk::Text
then you need to attach data to the widget so you can find it again
my $text1 = Gtk::Text->new;
my $text2 = Gtk::Text->new;
$text1->{name} = "first"; #perlish way
$text2->{name} = "second"; #perlish way
$text1->set_name("first"); #Gtk way
$text2->set_name("second"); #Gtk way
.
.
.
#perlish way
for my $child ($notebook->get_current_page->child->children) {
if (ref $child->{name} eq "second") {
$child->insert(...);
}
}
#gtk way
for my $child ($notebook->get_current_page->child->children) {
if (ref $child->get_name eq "second") {
$child->insert(...);
}
}
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
--
Phil
--------
The personnel office received an email requesting a listing
of the department staff be supplied, broken down by age and sex.
The personnel office sent this reply:
"Attached is a list of our staff. We currently have no one broken
down by age and sex. However, we do have a few alcoholics."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]