Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Tkx g_bind to menu on listbox only for selected row

by v4169sgr (Novice)
on Jan 17, 2013 at 13:15 UTC ( #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!

Comment on Tkx g_bind to menu on listbox only for selected row
Download Code
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
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? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2014-07-30 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (230 votes), past polls