I am trying to lock the TTIWIPhoneRegion.DeviceOrientation parameter without success.
For example: On telephone I want to lock my app so it stays on oVertical and on a Tablet it stays on oHorizontal.
Is there a way to do this?
Please note that the DeviceOrientation property only affects the orientation of the IWIPhoneRegion at design time. The region is client aligned at run time by default.
To adapt the appearance of your app to the device it is displayed on, see the following FAQ entry:
Thank you, I'm aware of that code (and using it). But the problem is that I'm trying to align the components at the center of the screen when the user changes the orientation of the phone/tablet and I can't get this kind of alignment to work (with Delphi).
When I try to program the alignment by calculating the sceen's width and positioning the components at the center they got to wierd positions and I have to reload the screen (not acceptable).
I tried this:
procedure TFrmMainMobile.IWAppFormResize(Sender: TObject);
if (RgnMblLog.Visible) then
ImgLogoLab.Left := (self.Width - ImgLogoLab.Width) div 2;
EdMblNome.Left := (self.Width - EdMblNome.Width) div 2;
EdMblPW.Left := EdMblNome.Left;
LblMblCod.Left := EdMblNome.Left;
LblMblPw.Left := EdMblNome.Left;
LblTbltTipoLog.Left := EdMblNome.Left;
CmbMblTipoLog.Left := EdMblNome.Left + EdMblNome.Width - CmbMblTipoLog.Width;
BtnMblLogon.Left := (self.Width - BtnMblLogon.Width) div 2;
with no success.
The left parameter is calculated correctly (I verified debugging) but the render isn't applied correctly.
Any ideas? Perhaps I should try some other way? Is there some parameter that I should set to make this work?