Date: Wed, 26 Jun 2002 00:33:58 -0500 (CDT) From: Timmy Douglas Subject: working with notebooks To: lablgtk at kaba.or.jp Message-id: <20020626.003358.78704005.timmy at timmy> MIME-version: 1.0 Content-type: Text/Plain; charset=us-ascii Content-transfer-encoding: 7BIT i'm writing a program that is like an IM client that uses tabs for conversations. i am thinking that it is best if, when i open a conversation with a person, that i create a new tab and widgets dynamically and bind all the callbacks and functions then and there because i wouldn't know how to access the stuff after the variables go out of scope. well i have a vbox that is what is thrown into the notebook and i want to remove the tab when the user clicks the close button i made: here is some code: let my_vbox = GPack.vbox ~homogeneous:false ~packing:(fun w -> conversation_notebook#append_page ~tab_label:(GMisc.label ~text:receiver_login_name ())#coerce w) () in let my_vpane = GPack.paned `VERTICAL ~packing:(my_vbox#pack ~expand:true ~fill:true) () in let my_msg_text = GEdit.text ~editable:true ~word_wrap:false ~line_wrap:true ~packing:my_vpane#add1 () in let nested_vbox = GPack.vbox ~homogeneous:false ~packing:my_vpane#add2 () in let my_private_message_text = GEdit.text ~editable:true ~word_wrap:true ~line_wrap:true ~packing:(nested_vbox#pack ~expand:true ~fill:true) () in let nested_hbar = GPack.hbox ~homogeneous:false ~packing:(nested_vbox#pack ~expand:false ~fill:true) () in let button_send_my_message = GButton.button ~packing:(nested_hbar#pack ~expand:true ~fill:true) () in let button_send_my_message_label = GMisc.label ~text:"Send Message" ~justify:`LEFT ~line_wrap:true ~packing:button_send_my_message#add () in let button_close_conv = GButton.button ~packing:(nested_hbar#pack ~expand:false ~fill:true) () in let button_close_conv_label = GMisc.label ~text:"Close Window" ~justify:`LEFT ~line_wrap:true ~packing:button_close_conv#add () in let _ = button_close_conv#connect#clicked ~callback:(fun () -> my_vbox#destroy()) in () -------- | blah | -------------------------------------------- | | | | | | |=======================================[]=| | | |__________________________________________| | Send Message | Close Conv. | -------------------------------------------- two problems so far: - i don't think i am destroying the tab the right way. i got this message while it was running: Gtk-CRITICAL **: file gtkobject.c: line 1179 (gtk_object_unref): assertion `object->ref_count > 0' failed. - the vpane is ends up at the bottom of the notebook and i have to move it up to split everything properly... and i hope it is possible to change the notebook tab's (a label's) text or the color? (i want to change it when when the tab dosen't have focus and a new message comes in) thanks for replies.