Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I'm enjoying Gtk2 quite a bit. I'm very new to it, but I've written some semi-fancy things with ease and it's just fun.

I got kinda stumped on tool tips though. I seem to be able to get them working everywhere except Gtk2::SimpleLists (which are really Gtk2::TreeViews).

It seems like I found most of the related topics, but I can't seem to get it to work. I want to add a tooltip to some of the rows of my simplelist.

# This is mostly their SmipleList example. They skipped warnings and +strict, # I only wrote the (non-working) tooltip stuff. 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/; $categories->set_has_tooltip(TRUE); # NOTE: thought this might help (n +ope) $path = Gtk2::TreePath->new_from_indices(0); $tip = new Gtk2::Tooltip; $tip->set_text("tooltip test"); $categories->set_tooltip_row($tip, $path); # NOTE: thought this might help, but I fail to see how it would # $categories->signal_connect( 'query-tooltip' => sub { # warn Dumper({args=>\@_, useless=>{tip=>$tip, path=>$path}}); # }); $window = Gtk2::Window->new; $window->set_title ('SimpleList examples'); $window->signal_connect (delete_event => sub {Gtk2->main_quit; TRUE}); $window->set_default_size (800,600); $window->add($categories); $window->show_all; Gtk2->main;

The documentation for both the C and the .pm is a little light (doxygen?), but I think I might need to do something with the signal? I believe it's been possible to do this since gtk 2.12.0, but I'm clearly missing something. There's some example code in the t/GtkTreeView.t that calls set_tooltip_row(), but it seems to be an example of testing something rather than an example of putting a tooltip on a row.

-Paul


In reply to Gtk2 Treeview/Simplelist and set_tooltip_row() by jettero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (6)
    As of 2014-10-22 04:16 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (112 votes), past polls