logo       

Re: Getting currently-selected Gtk::Notebook page: msg#00081

gnome.gtk+.perl

Subject: Re: Getting currently-selected Gtk::Notebook page

On Thu, 2003-10-09 at 04:25, Ken Restivo wrote:

> "switch-page"
> void user_function (GtkNotebook *notebook,
> GtkNotebookPage *page,
> gint page_num,
> gpointer user_data);
>
> I tested this in C, and the page_num variable does in fact deliver the
> correct number.
>
> But in Perl all I can shift out of there is the notebook widget itself.

Well, it seems to work for me:

$notebook -> signal_connect(switch_page => sub {
warn join(", ", @_);
});

gives someting like:

Gtk2::Notebook=HASH(0x865340c), 142057896, 2 at ...

which is what the prototype suggests.

Of course, the GtkNotebookPage parameter is not correct. It's a struct
and supposedly gets cast to an integer. We'd need custom marshalling for
this to work correctly, but as far as I can tell that struct is supposed
to be private anyway.

HTH,
-Torsten


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise