Is there a way to lock device orientation?

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?

Thank you.

Hi,


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: 
http://www.tmssoftware.com/site/tmsiwiphone.asp?s=faq&show=475

Hello Bart,


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);
begin
  if (RgnMblLog.Visible) then
  begin
    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;
  end;
end;

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?

Thank you
Andrew

Hello Andrew,

Does the issue also occur when running the application on a desktop browser and the window is resized?
From your message it's not clear which components you are trying to center align.
Does the issue also occur when using only default IntraWeb controls or only with controls from the TMS IntraWeb iPhone controls pack.

If the issue also happens using only default IntraWeb controls, I would recommend to contact Atozed software for further assistance.
If not, please provide a ready to run sample project that demonstrates the issue so I can further investigate this. 
Please also provide the name of the device/browser you are using and the IntraWeb version you are using.

As a workaround, have you considered using CSS positioning to handle the center aligning fully client-side?