Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 2504

FMX TFrame Mouse Events?

$
0
0

This refers to Tokyo 10.2.  I'm trying to capture the mouse events on an FMX TFrame instance but for some reason these events are not available unless the frame parent is a form.  I created a new frame instance during runtime and made an existing TScrollBox component the parent.  I can assign and capture the OnClick event of the instance, but assigning the OnMouseDown, OnMouseMove, and OnMouseUp events do nothing - those events don't fire.  The HitTest value is "true".  I added a TRectangle component to the TFrame definition for visibility (HitTest = false) to ensure I was actually creating something.

Now, assigning those mouse events from the Frame (TMyFrame) itself does work, but I would like to access those events from the perspective of the container (the scrollbox).  Is it possible to access those events from outside the TMyFrame definition?

Regards, Brad

Addendum:

I did leave one part out...I forgot to "add" the frame to the scrollbox.  I added my frame manually in the designer to the scrollbox and verified it was listed as a subcomponent to the TScrollBox.  I then added an "OnMouseDown" event and verified that indeed this event was getting called when I clicked on the frame during runtime.

I looked at the manually-created instance and verified (also in the FMX code) that the parent of the frame is set to the containing form.  Most importantly the frame is also added to the contents of the scrollbox.

Reworking the runtime code to add a new frame, I created the frame (parent set to main form) and then used the "AddObject()" method on the scrollbox.  I assigned the OnMouseDown event as usual.  The mouse events are still not captured.

The two frame instances appear to be set up similarly, but something is missing in the one created during runtime that is blocking mouse events.  I seem to be missing something, I would appreciate help pointing me in the right direction.

BTW, a workaround that does work is to simply use a derived TControl, like TMyRectangle.  I can capture the events for these.


Viewing all articles
Browse latest Browse all 2504

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>