To amplify on what AnonymousMonk said about it requiring a Toplevel window to display an arbitrary widget ( other than a Menu ), your best hack is to try and use an overrideredirect window. Here is a simple example, and you will need to work out the details of the enter/leave bindings for your Tree. It helps that bind sends the the calling widget as the first element of @_.
#!/usr/bin/perl use warnings; use Tk; use strict; my $main = new MainWindow; $main->geometry('200x200'); $main->Button(-text=>"click",-command=>sub{ print "Button left click\n"; })->pack; $main->bind('<ButtonPress-3>', \&some_sub); MainLoop; sub some_sub{ print "@_\n"; my $widget = shift; my $x = $widget->pointerx; my $y = $widget->pointery; my $mw_bdw = 2; #mainwindow border width ### Create a Mainwindow ### my $top = new MainWindow(-borderwidth=>$mw_bdw, -relief=>'ridge', -bg => "#0000FF"); $top->geometry("150x100+$x+$y"); # displaying at top left on any resol +ution $top->overrideredirect(1); # Remove window decorations and keep on all + screens ### create a text widget ### my $imstr = "THIS IS A TEST NOTIFICTION LONG ENOUGH TO WRAP"; my $TEXT = $top->Text( -foreground=> 'white', -background=> '#0000FF', -wrap => 'word', -height => 7, -width => 50)->pack; $TEXT->insert('end', "$imstr", ); #$top-> after(5000, \&exitprg); # autoclose in 5000 milisecs $top->bind('<ButtonRelease>',sub{$top->destroy}); #or sub exitprg MainLoop; #### FUNCTIONS #### sub exitprg { my $top = shift; print STDERR "CALLED EXIT\n"; $top-> destroy; # to kill the window and exit from prog } }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: How to popup a widget such as “entry” or “label” at the mouse location by zentara
in thread How to popup a widget such as “entry” or “label” at the mouse location by smh

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!
  • 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:
    & &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.