Masao Mutoh
12/12/2005 1:42:00 PM
Hi,
"tab_label" is not "child" of Gtk::Notebook.
Try code below.
HTH.
On Mon, 12 Dec 2005 18:32:38 +0900
"Clayton Smith" <ces.fci@gmail.com> wrote:
> Unfortunately, I had problems with what I came up with. By using the
> following, when middle clicking on any of the tabs it finds the
> page_num to be -1 ..
> --------------
> #!/usr/local/bin/ruby --verbose
> require 'gtk2'
> include Gtk
> init
> win = Window.new
> win.set_default_size 300, 300
>
> hbox = HBox.new( false, 0)
> win.add(hbox)
>
> nb = Notebook.new
> hbox.add(nb)
>
> def add_page nb
> vbox = VBox.new( false, 0)
> tab_label_box = EventBox.new
> label = Label.new('test')
> tab_label_box.add(label)
> tab_label_box.show_all
> tab_label_box.signal_connect('button-press-event') do |widget,
> event|
> if event.event_type==Gdk::Event::BUTTON_PRESS and
> event.button==2
> puts nb.page_num(widget) # <-- not recognizing as a child ?
puts nb.page_num(vbox) # FIXED!
> end
> end
> nb.append_page( vbox, tab_label_box)
> end
>
> add_page nb
> add_page nb
> add_page nb
>
> win.show_all
> main
--
:% Masao Mutoh<mutoh@highway.ne.jp>