Jump to content

Stewag

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

1 Neutral
  1. Stewag

    FMX views: Which one is applied?

    Oh, I was not aware, that it is yours I am even more thankful then! Have you tested the behaviour with a mobile app for general usage?
  2. Stewag

    FMX views: Which one is applied?

    Thank you Patrick, that is really helpful! I must admit that I was a little confused in the beginning, but I found a good tutorial, that shows TScaleLayout's function: https://www.youtube.com/watch?v=zaMaCGLZQt8&ab_channel=D%C3%A9veloppeurPascal Steffen
  3. Since long I wonder, how the different views that I configured for iOS and Android form-factors apply to displays, that do not fit in. For example, I saw at a friend's 6.5" Samsung that a "wrong" text size is used. I configured 5.8" and 6.8" views and would like to know which one (if any?) of the two was applied to the 6.5" device. I tried to find a way to display the currently applied fmx view, e.g. by pressing a label but have found no way yet. Maybe this is not possible as events are inherited? Or is there a way? I use TGrindPanelLayout to evenly spread components over the screen but have found no way yet, to scale text size for displays from 3.5 to 10 Inch displays other than using views. I'd be happy to abandon views and solve the text-size scaling problem with code. Any ideas for this out there?
  4. procedure TfMain.IOSTurn(Portrait: boolean); // Source: https://en.delphipraxis.net/topic/1796-firemonkey-change-ios-screen-rotation-at-runtime/ var LID: Pointer; begin if Portrait then begin Application.FormFactor.Orientations := [TScreenOrientation.Portrait, TScreenOrientation.InvertedPortrait]; if not TOSVersion.Check(16) then // iOS lower than 16 begin showmessage('Please turn phone back to portrait'); TurnIOStoPortrait := False; // turn off message to prevent multiple display end; end else begin Application.FormFactor.Orientations := [TScreenOrientation.Landscape, TScreenOrientation.InvertedLandscape]; end; if TOSVersion.Check(16) then // iOS Version 16 and up begin LID := NSObjectToID(TiOSHelper.sharedApplication.keyWindow.rootViewController); TUIViewControllerEx.Wrap(LID).setNeedsUpdateOfSupportedInterfaceOrientations; end else // iOS 13: no automatic rotation. Not tested for iOS<13 begin TUIViewController.OCClass.attemptRotationToDeviceOrientation; if TabControl1.ActiveTab.Name = 'XXX' then // limit message to specific tab showmessage('Please turn phone to landscape'); end end; Dave's code works magnificently - thank you Dave! Here is an alternative procedure to Dave's Button1Click() that works both ways and includes messages to rotate the phone manually. This is necessary for iOS lower than 16, where the content but not the display is rotated by the code. In IOS 16 and up, rotation is done smoothly automatically. I could only test iOS 13 though, maybe someone can extend the code to iOS < 13? Steffen
×