Re: Notebook singal connects

On Jan 6, 2005, at 5:17 PM, Tyler Hepworth wrote:

I have a notebook object with two pages on it.  I want to generate an
event when a page is selected.  I have tried the following:

    $self->{'notebook'}->signal_connect ('select-page' => sub {
        [do some stuff here]

But nothing happens. The C API docs state that this is a signal since "2.4".

iiiiiinteresting... where do you see that?  i don't see it here: GtkNotebook.html#GtkNotebook-select-page

and i see the select-page signal listed in the pod on my powerbook, which uses gtk+-2.2.4 from fink.

I am using Wayne Keenan's distribution on windows which is only Gtk+ 2.2.4 and Gtk2 1.020. Does the signal not work because of the distribution version I am using?

To the bindings, signals and properties are different from methods and functions in that they are available through introspection, and thus simply exist in the bindings so long as they exist in the bound libraries. That is, if the signal is in the version of gtk+ you're using, you should be able to use it regardless of what version of Gtk2 you have.

Functions and methods are not available through introspection (although there has been some discussion on gtk-devel-list and language-bindings on how to do this), so they are only available if the bindings support them and are compiled for them. That is, you can only use a function from 2.4 if the bindings support 2.4 *and* were compiled against 2.4 (and provided we bound that particular function ;-).

Is there another signal I can use?

What about switch-page?  it even gives you the current page's index. GtkNotebook.html#GtkNotebook-switch-page

The second argument of that signal is listed as gpointer in the pod but as a GtkNotebookPage in the docs; GtkNotebookPage is a private type (an opaque, or incomplete, type in the public API), and thus is unusable in perl. Just ignore it.

She's obviously your child. She looks like you, she talks a lot, and most of it is gibberish.
  -- Elysse, to me, of Zella.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]