Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse Click and Hold over multiple Items in Listbox

Status
Not open for further replies.

networkthis

Programmer
Jul 11, 2011
29
US
Is there a mouse command for clicking and holding of a mouse button?

Example - I want to display the list of what is highlighted as a user mouses over items in a listbox while the mouse button is held down. I can get it to work with ctrl + click, click and up, and click and down, just not sure of the command for doing a click and hold?
 
Click+drag is actually problematical in some versions of VFP. There was a bug where a click-drag would change .Value and .Selection but NOT fire .Valid or .InteractiveChange. There was no way to detect the user's selection change.

The paradigm you describe doesn't make a lot of sense to me. Normally "stuff happens" in response to a user selection or other action. A click-drag isn't a selection or action until it ends, but you seem to want it to be on-going.

You might try a timer monitoring location properties set in mousemove() but it's going to be dicey. When something is dicey and difficult to do, it's often advisable to rethink what you're trying to do. :)
 
Thanks for the reply - it made me realize that I forgot about Interactivechange :-/

It works great now.
 
You would normally use the MouseEnter and MouseLeave events to perform some action while the mouse is hovering over a control, but unfortunately they're not available for a listbox.

If you could get by a with a grid, it should be possible to use those events in conjunction with GridHitTest.

It might also be possible to do it with ON KEY LABEL LEFTMOUSE.

But both those approaches are a big kludgy, and in any case, it's not really clear to me what you are trying to achieve.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
You would normally use the MouseEnter and MouseLeave events to perform some action while the mouse is hovering over a control, but unfortunately they're not available for a listbox.

Huh? Listboxes have those events, or did you mean something else?

Tamar
 
Thanks to everyone for the replies. I accomplished what I was trying to do.

In interactivechange I simply looped through the list box and gathered each of the selected items.

Based on the criteria in the columns of my List Box - I wanted to dynamically display the actual Report # for each of the currently selected items (Report #'s aren't listed in the listbox).

Interactive change worked for clicking the mouse + holding and selecting items. It also works for, click + spacebar, ctrl + spacebar, click, rightclick, etc.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top