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

Tkx g_bind to menu on listbox only for selected row

by v4169sgr (Sexton)
on Jan 17, 2013 at 13:15 UTC ( [id://1013776]=perlquestion: print w/replies, xml ) Need Help??

v4169sgr has asked for the wisdom of the Perl Monks concerning the following question:

Hello! I use perl 5.10 on a winXP platform (Perl ActiveState), with tkx for my GUI.

I use listbox for displaying data strings, one string per row. I have implemented a context menu bound to the right button of the user's mouse, which works well.

$list->g_bind("<3>", [ sub {my($x,$y) = @_; $listmenu->g_tk___popup($x,$y)}, Tkx::Ev("%X", "% +Y") ]);

I now wish to bind this menu to a mouse-over event.

My problem is that I don't want the menu to appear when the mouse pointer enters the entire listbox. I only want it to appear when the pointer enters the row or rows that the user has selected.

There does not seem to be an obvious way of doing this. How will I go about solving the problem?

Thanks!

Replies are listed 'Best First'.
Re: Tkx g_bind to menu on listbox only for selected row
by Anonymous Monk on Jan 18, 2013 at 01:41 UTC

    There does not seem to be an obvious way of doing this. How will I go about solving the problem?

    Seems to me a menu does that already :) anyway

    my $index = $lb->nearest( $y) ; $lb->activate( $index );
      <motion>

      Thanks for the reply :) If I understand correctly, this code will select the row in the listbox nearest to the y coordinate of the event.

      I don't actually want to do that. What I want to do is only have the event trigger on mouseover the already selected row, and not the entire listbox. Does that make sense?

        I don't actually want to do that. What I want to do is only have the event trigger on mouseover the already selected row, and not the entire listbox. Does that make sense?

        sure, you have the nearest, just check to see if it is selected

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1013776]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-03-19 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found