silverlight 3 how can i get element under mouse - silverlight-3.0

How can i get element under mouse. I try to get this under mouse move event.
Tnx.

Use the VisualTreeHelper.FindElementsInHostCoordinates method.
Here is an example.

Related

Changes the cursor when dragging a borderless window

I use the code in Bruce McGee's reply in this post, to drag a borderless window, and it works great.
The problem was that I could not find a way to change the mouse cursor at the start of the drag (and return it at the end of the drag). OnMouseDown and OnMouseUp events seem to go wrong after reading this code in the OnMouseDown event.
How can I do this?

How do I detect clicking and double-clicking a node in a TreeView?

How do I track the event of clicking a node or double-clicking a node item (meaning, that textual thing next to the plus sign) in a tree view, but not the treeview itself?
Detect a click or double-click on the control in general with the OnClick and OnDblClick events. To find out which specific node was clicked, use the control's GetNodeAt method with the mouse's current coordinates.
You can get the coordinates as they were at the time of the click with GetMessagePos; reading Mouse.CursorPos will give you the coordinates at the time you read the property, which might be very different from the time of the click if there is any sort of load on the system, and that can lead to detecting clicks at places that aren't even within the bounds of your control.
Use usual OnClick and OnDblClick events and look which is the current node item.
http://docwiki.embarcadero.com/Libraries/XE3/en/Vcl.ComCtrls.TCustomTreeView.Selected
See also linked examples.
But better use VirtualTreeView.
http://www.lischke-online.de/VirtualTreeview/VTGallery.php
http://code.google.com/p/virtual-treeview/

How to get the control under the mouse cursor in onMouseDown event?

I have a TGridLayout filled with some images in a Firemonkey HD Application. In the gridLayout's onMouseDown event I want to get the image object on which the user has clicked, but I have only mouse coordinates.
Implementing onMouseDown event for every image is not an option, because if an image is removed from the gridlayout an empty space remains. In this case I also want to know if the user has clicked in this empty area.
Is there a some kind of "getChildAtPos" or "FindVCLWindow" analog in Firemonkey?
Thanks!
TForm.ObjectAtPoint should do the trick.
FindVCLWindow does what you need. You need to specify the point at which the control is, in your case it's mouse position.

Detect hover when dragging html element on touch device

When you are dragging an element using the touch events (DnD on touch screens), how do you detect that the object that you are dragging is over another object?
With jQuery is easy, add "collide: 'block'" or "collide: 'flag'" when you create a draggable.
http://plugins.jquery.com/project/collidable
I haven't found any direct solution for this. One can have draggable element positioned "outside" dragging finger, but this didn't work in my case.
In my case, I had a grid-like element with fixed size child elements. Therefore it was easy to compare pageX/pageY of touchmove to the parent element and count the current element index by dividing the result with their dimensions.

Cause 'hint' to refire on listview as I move over items

Sure I've seen this done before but off-hand I can't find any examples.
I've got a TListView, set in 'report' viewstyle. It has about half a dozen subitems, and one thing we'd like to do is have the 'hint' (tooltip) on the listview dynamically show another field of data. That is, each time you move the mouse over any given row, the 'hint' would show some text relevant to that particular row.
I'm partway there - I can do this using the OnInfoTip method, but unfortunately once a tip has appeared, Windows seems to decide that I don't need to see a hint for the listview again until I move the mouse away from the listview and then back 'over' it again. Simply moving the mouse down to the next row, all-the-time keeping the mouse over the control, doesn't persuade the program to display the new hint.
Just to be clear - I've got OnInfoTip working so that the program does display the right hint relevant to the item I first moved the mouse over. Changing the hint text isn't the issue. The problem is that moving the mouse to another item in the listview doesn't cause the software to show a new hint. (Hope that makes sense).
Is there some proper way of getting this behaviour to work, or am I going to end up doing something icky with mouseovers and then manually drawing a hintbox (etc)?
check the following link:
Display Custom Hints for TListView Sub Items
Edit:
I just checked it now on delphi7 it's showing the hint for every row dynamically after moving the mouse on the listview.
Offtopic: This is simple in Virtual Treeview component, it is build-in feature.
i was using the OnInfoTip event (i didn't need hints for the subitems). the hint was "flashing" (show/hide/show/hide/show/hide/show/hide). found the listview's ShowHint was false. set it to True and it worked as it should.

Resources