To: Arnold 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> <43BAED64.8060109 at wanadoo.fr> From: David MENTRE Organization: none Date: Fri, 06 Jan 2006 21:58:46 +0100 In-Reply-To: <43BAED64.8060109 at wanadoo.fr> (arnold.guillaumot at wanadoo.fr's message of "Tue, 03 Jan 2006 22:32:20 +0100") Message-ID: <87bqypf4zd.fsf at linux-france.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hello Arnold, Thank you for your reply, but unfortunatly none of your two methods work. Arnold writes: > 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. I can successfully add a label and a tooltip to this label, but this tooltip is never displayed (in fact, I don't understand the meaning of set_widget on a treeview_column). > 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 -> .... This does not work as the "col#widget" always returns None (as in my initial issue: no widget attached to the TreeView). I even tried to add a button and set the tooltip on the button, to no avail: ... let renderer = GTree.cell_renderer_toggle [] in let col = GTree.view_column ~title ~renderer:(renderer, ["active", backend_col]) () in let button = GButton.button ~label:title () in col#set_widget (Some button#coerce); MiscUI.tooltips_group#set_tip ~text:tip button#coerce; ignore(view#append_column col) in ... The button is correctly displayed but its tooltip is never shown. I even ensured that "tooltips_group#enable ()" is called. :-( Best wishes, d. -- pub 1024D/A3AD7A2A 2004-10-03 David MENTRE 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A