Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Just for a quick hack check, I substituted in the code from the treeview tooltip example link from my previous response, derived the model from the $catagories SimpleList, and it seems to work( some minor problems to work out like popup position, columns not existing, and what to do with selected rows. Here it is if you care to work out the bugs, I'm lazy today. :-)
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use Gtk2 '-init'; use Gtk2::SimpleList; use constant TRUE => 1; use constant FALSE => 0; my $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) my $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; # This is our little tooltip window. my $tooltip_label = Gtk2::Label->new; my $tooltip = Gtk2::Window->new('popup'); $tooltip->set_decorated(0); $tooltip->set_position('mouse'); # We'll choose this to start with. $tooltip->add($tooltip_label); my $tooltip_displayed = FALSE; my $selected_row = 0; my $selected_col = 0; =head1 my $popup_hash; my $row = 0; foreach my $child(@children) { my $child_iter = $model->append ($iter); $model->set ($child_iter, 0, $child->{label}, 1, $child->{this}, 2, $child->{that}, 3, $child->{what}, 4, undef, ); # We'll populate the hash here my $path = "0:".$row; $popup_hash->{$path}->{1} = $child->{this_popup}; $popup_hash->{$path}->{2} = $child->{that_popup}; $popup_hash->{$path}->{3} = $child->{what_popup}; $row++; } print Dumper $popup_hash; =cut $categories->signal_connect('motion-notify-event' => sub { my ($self, $event) = @_; my ($path, $column, $cell_x, $cell_y) = $categories->get_path_ +at_pos ($event->x, $event->y); if ($path) { my $model = $categories->get_model; my $i = $column->{column_number}; my $row = $path->to_string(); # If a new cell is selected, then hide the tooltip # It'll be re-shown as required by the code down under if ($selected_row ne $row or $selected_col != $i) { $tooltip->hide; $tooltip_displayed = FALSE; $selected_row = $row; $selected_col = $i; } if ($row) { # Pick that popup string from our hash #my $str = $popup_hash->{$row}->{$i}; my $str = " row $row "; if ($str) { $tooltip_label->set_label($str); if (!$tooltip_displayed) { $tooltip->show_all; my ($thisx, $thisy) = $tooltip->window->get_or +igin; # I want the window to be a bit away from the +mouse pointer. # Just a personal choice :) $tooltip->move($thisx +10, $thisy+10); $tooltip_displayed = TRUE; } } } return 0; } } ); Gtk2->main;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Gtk2 Treeview/Simplelist and set_tooltip_row() by zentara
in thread 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 chilling in the Monastery: (14)
    As of 2014-10-31 16:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (221 votes), past polls