Message-ID: <43BAED64.8060109 at wanadoo.fr> Date: Tue, 03 Jan 2006 22:32:20 +0100 From: Arnold MIME-Version: 1.0 To: David MENTRE Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: How to set a tooltip on a view_column? References: <87fyo55f9i.fsf at linux-france.org> In-Reply-To: <87fyo55f9i.fsf at linux-france.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit David MENTRE wrote: >However, the "col#widget" of my freshly created view_column alaways >return None. How can I get the widget of the view_column? Is there any >other way to add a tooltip on a Tree View column? > > I think you have to set explicitly the widget instead of using the ~title in GTree.view_column. ... let renderer = GTree.cell_renderer_toggle [] in let col = GTree.view_column ~renderer:(renderer, ["active", backend_col]) () in let label = GMisc.label ~text:title () in col#set_widget (Some label#coerce); ... then col#widget should return a widget. If you also want to access the GButton.button in the GTree.view_column title, it's possible to get it like this (maybe not the more elegant ...) let button = let rec get_button w = match w with None -> None | Some p -> begin let name = Gobject.Type.name (Gobject.get_type p#as_widget) in if name = "GtkButton" (* try to cast our GObj.widget to a GButton.button *) then try Some (new GButton.button (Gobject.try_cast p#as_widget name)) with _ -> get_button p#misc#parent (* check the parent of our GObj.widget *) else get_button p#misc#parent end in get_button col#widget in match button with None -> () | Some b -> .... hope that can help regards