Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Tkx g_bind to menu on listbox only for selected row

by v4169sgr (Sexton)
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!

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
Node Status?
node history
Node Type: perlquestion [id://1013776]
Approved by ww
help
Chatterbox?
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-06-25 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.