Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Gtk2 Treeview/Simplelist and set_tooltip_row()

by jettero (Monsignor)
on May 01, 2008 at 19:17 UTC ( #683994=note: print w/replies, xml ) Need Help??

in reply to Re: Gtk2 Treeview/Simplelist and set_tooltip_row()
in thread Gtk2 Treeview/Simplelist and set_tooltip_row()

Muppet, I was just going to link to that! Thanks again for your help. I think your code should also be here natively in a readmore code tag. Links have a way of aging out after a while.
# this is from muppet via +t/2008-April/msg00087.html use strict; use Data::Dumper; use Gtk2 '-init'; use Gtk2::SimpleList; use constant TRUE => 1; use constant FALSE => 0; $categories = Gtk2::SimpleList->new ('Categories' => 'text'); $categories->set_headers_visible(FALSE); @{$categories->{data}} = qw/Meat Beer Pizza Pasta Soda Juice Rabbitfoo +d/; # This turns on the tooltip event monitoring in the widget... $categories->set_has_tooltip(TRUE); # Tooltip event monitoring causes the query-tooltip signal to be emitt +ed. $categories->signal_connect (query_tooltip => sub { my ($widget, $x, $y, $keyboard_mode, $tooltip) = @_; # First, find out where the pointer is: $path = $categories->get_path_at_pos ($x, $y); # If we're not pointed at a row, then return FALSE to say # "don't show a tip". return FALSE unless $path; # Otherwise, ask the TreeView to set up the tip's area according # to the row's rectangle. $categories->set_tooltip_row($tooltip, $path); # And then load it up with some meaningful text. This is much # more interesting when you have columns that aren't visible, # or the TreeView is too narrow to see all of your column. my $index = ($path->get_indices)[0]; $tooltip->set_text(${ $categories->{data} }[$index][0]); # Return true to say "show the tip". return TRUE; }); $window = Gtk2::Window->new; $window->set_title ('SimpleList examples'); $window->signal_connect (delete_event => sub {Gtk2->main_quit; TRUE}); $window->add($categories); $window->show_all; Gtk2->main;


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://683994]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-03-17 21:16 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (226 votes). Check out past polls.