Embarcadero C++Builder 10.3.2 Enterprise
Searching the internet, I could not find any FMX code for this. Based on Delphi code, this should have worked but the compiler does not like it
if (Application->FormFactor->Orientations == Fmx::Types::TScreenOrientations::Landscape) {
//Landscape
}
Also, the value of Application->FormFactor->Orientations is the same whatever the orientation of the iphone. {System::SetBase = {Data = {[0] = 11 '\v'}}} How does one determine the orientation?
The
Orientationsproperty is aTFormOrientations, which is aSystem::SetofTFormOrientationvalues. You can't useSet::operator==to compare it to a single value, which is why you are getting a compiler error. However, you can use theSet::Contains()method to check if it has a given value, eg:In any case, the
Orientationsproperty specifies which orientation(s) the application's Forms are allowed to take (a value of 11 has its 1st, 2nd, and 4th bits set to 1, which correspond to thePortrait,Landscape, andInvertedLandscapeorientations being enabled). It does not report what the device's current orientation is. For that, use theIFMXScreenService::GetScreenOrientation()method instead, eg: