I would bet that Tk can do what you want. Your problem of having single line messages, being clickable, and a callback to display additional data is doable a few ways in Tk. Can you show us some code? If I was going to try an do it, I would print the results to a text widget, and create custom tags for each line printed, and tag that line. Then have a balloon, or mouse enter/clicked bindings on the tags, to display the extra data associated with that line. Here is an example, where you can store "meta-data" for each line, in a tag(or hash), and pop that data up in a balloon
when that tagged-line is clicked or enetered. You could also do it with a Canvas, if you wanted to add some graphics.
This example shows just the basics, I print the data to stdout, instead of a balloon or a toplevel extra-info window. Also, I create 100 tags in a simple loop, but in your situation, you will wnat to tagconfigure each tag, for each line, as they come in and are printed.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = tkinit;
my $t = $mw->Scrolled('Text',
-scrollbars => 'osoe'
)->pack;
for(1..100){
$t->tagConfigure( 'data'.$_, -data => $_ x 20,
);
}
for(1..100){
$t->insert('end', 'Line'."$_\n", ['datarider','data'.$_ ]);
}
$t->tagBind( 'datarider', '<Enter>', sub { getdata($t) } );
$t->tagBind( 'datarider', '<Leave>', sub { getdata($t) } );
$t->bind( '<Motion>', sub{ getdata($t) } );
MainLoop;
sub getdata {
my ( $text_widget ) = @_;
my $x = $text_widget->pointerx - $text_widget->rootx;
my $y = $text_widget->pointery - $text_widget->rooty;
#print "$x $y\n";
my $txt_index = $text_widget->index( '@' . $x . ',' . $y );
#warn $txt_index;
my ( $line, $char ) = ( $txt_index =~ /^(.+?)\.(.+?)$/ );
my @tags = $text_widget->tagNames($txt_index);
print "@tags\n";
foreach my $tag(@tags){
print $text_widget->tagCget($tag,'data'),"\n";
}
}
I'm not really a human, but I play one on earth.
flash japh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.