0
votes

I am creating a button array in Firemonkey and each of the buttons are created by loading a style from a resource.

FButtons[r,c] := TLayout( TStyleManager.LoadFromResource(HInstance, BUTTON_STYLE, RT_RCDATA) );
FButtons[r,c].Parent := Self;
FButtons[r,c].Stored := false;
FButtons[r,c].HitTest := true;
FButtons[r,c].OnMouseDown := OnButtonMouseDown;

The contents of the resource is just copied from a TButton (dark style).

The problem I am having is that the button does not animate a pressed state. So I am trying to capture the OnMouseDown event to fire the "IsPressed" animation but the OnMouseDown is never triggered. Any ideas why OnMouseDown is not happening?

Thanks in advance. Martin

2

2 Answers

0
votes

If you are using custom FM style, then ensure HitTest property of style's elements (containers probably) is set to False. If HitTest is True the style itself will "swallow" the event.

You may find more information here:

0
votes

Dont know why but setting

Locked := true 

fixed my problem.