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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...