Jump to content
IElite

How do I lock to dimensions and orientation?

Recommended Posts

 

As an example, lets say I want to use profile orientation only, and use the Iphone 4 (3.5" screen) as my dimensions?  

 

i.e. 480 pts (960 pixels retina)  X 320 pts (640 pixels retina)

 

How do I make it so the user can't rotate the application (always remains in profile orientation)

 

If loaded on another device with large dimensions, it remains fixed (locked) at the dimensions and orientation

 

thanx

Share this post


Link to post
Share on other sites

I think we can dynamically set layout parameters on Resize event. We can compare Width and Height before we resize the layout. I can't confirm if this approach will work on a real device. See preview at HelloWorld

 

procedure TForm1.Resize;

begin
  inherited;
  if ClientWidth > ClientHeight then begin

      FLayoutPortrait.Resize(Self);

  end;
end;

Share this post


Link to post
Share on other sites
procedure TForm1.Resize;
begin
  inherited;
  if ClientHeight > ClientWidth then begin
      FLayout.Resize(Self);


      Showmessage('test');


      s.Handle.style.setProperty('display', 'none');
  end else
  begin
      s.Handle.style.setProperty('width', '100%');
      s.Handle.style.setProperty('height', '100%');
      s.Handle.style.setProperty('position', 'fixed');
      s.Handle.style.setProperty('top', '0px');
      s.Handle.style.setProperty('left', '0px');
      s.Handle.style.setProperty('background-color', 'white');
      s.Handle.style.setProperty('background-image', 'url("res/playportrait.png")');
      s.Handle.style.setProperty('background-repeat', 'no-repeat');
      s.Handle.style.setProperty('background-position', 'center center');
      s.Handle.style.setProperty('display', 'block');
 end;

end;

Hi Just wondering why the resize event execute 4 times.. when i for example insert a messagebox ?

 

Ron

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×