Craig
Craig

Reputation: 1946

TFiremonkeyContainer won't respond to Mouse Events

I am using the Firemonkey Container control (https://github.com/vintagedave/firemonkey-container) so I can make a VCL application but have some FMX elements.

I ran into a problem though where by I can't get the TFireMonkeyContainer control to respond to mouse events (e.g, MouseDown, MouseEnter, MouseMove, MouseUp etc).

Probably something to do with how messages are intercepted but I am not sure.

In the code I tried publishing:

OnMouseDown OnMouseEnter OnMouseMove OnMouseUp

But as I say those methods never fire, oddly though OnDragOver and OnDragDrop work (already included in the component).

How do I get the TFireMonkeyContainer control to respond to Mouse events?

Basically I need to get the X and Y coordinate where the mouse is moving, and also when mouse down I need the X and Y coordinates too.

Thanks

Upvotes: 1

Views: 81

Answers (1)

SilverWarior
SilverWarior

Reputation: 8331

There is a flaw in your design.

You don't want your TFireMonkeyContainer to respond to any of the mouse events on itself. If it would then the FMX controls that are placed within the TFireMonkeyContainer would never register any of the mouse events since they would already be handled by TFireMonkeyContainer.

What you need to do is to setup proper events on each of the FMX controls.

Upvotes: 3

Related Questions