Event Handler for Dynamically Created TText array in FMX


I am creating an array of 81 (9×9) TText boxes in an android app. I need to find which box was touched to change the text. I followed the example at Event Handler for Dynamically Created CheckBox (Thanks Remy Lebeau) but I get the following two error msgs in C++ Builder 10.3.

The messages are:

“MouseUp is a protected member of Fmx::Controls::TControl”

and a very long msg

[bccaarm Error] MainFm.cpp(106): assigning to ‘void (closure *)(System::Uitypes::TMouseButton, System::Classes::TShiftState, float, float) __attribute((pcs(“aapcs-vfp”)))’ from incompatible type ‘void (closure *)(__borland_class *System::TObject __strong, System::Uitypes::TMouseButton, TShiftState, float, float) __attribute((pcs(“aapcs-vfp”)))’

Is there something I should do different in the creation of the TText to insure that it is a FMX control vs a … ? The form is a multi-device form, not VCL.

UPDATE: I had a head slap moment. I finally realized that I used the wrong event name. “MouseUp” as used in TextBoxMouseUp is NOT the event handler name; “OnMouseUp” is the correct one. That is,
BAD: TextBox[i][j]->MouseUp = FmMain->TextBoxMouseUp;
GOOD: TextBox[i][j]->OnMouseUp = FmMain->TextBoxMouseUp;

Hope this helps someone else in the future. As always, Remy, your instructions are dead on. We all just have to read every single word.

Comments are closed.