I have a snippet of code that casts a TFmxObject to a TForm and accesses it's Height and Width properties that works fine. AControl is a standard TControl, and the Parent property is a TfmxObject. edited: I am first checking with the IS keyword that the parent is in fact a TForm.
LPar:=TControl.Create(AControl);
LPar.Height:=(AControl.Parent As TForm).Height;
LPar.Width:=(AControl.Parent As TForm).Width;
On Windows, this code returns the values of Height and Width that I would expect and assigns it to LPar.Height and LPar.Width (Also a standard TControl), but as soon as I change the target platform to Android and debug using usb debugging on the device, the assignment is not an actual value but something like 6.2645644...+036 (Both Height and Width have the same invalid value).
I don't know if the problem lies with casting the TFmxObject as a TForm or.. really where to start with troubleshooting further. I've tried assigning AControl.Parent to a local TFmxObject and then performing the cast on the local variable (same results) and I have also tried casting using this syntax as well
TForm(AControl.Parent)
with no luck. Any help would be greatly appreciated.
Fixed it by installing Berlin 10.1 and just setting up the environment from scratch (installing packages, updating library paths etc...) I don't know if this was fixed by using the newer version of Delphi, or if it was me re-installing my packages.