Jump to content


Photo

How do I lock to dimensions and orientation?


  • Please log in to reply
3 replies to this topic

#1 ielite

ielite
  • Members
  • 704 posts

Posted 16 January 2016 - 11:09 PM

 
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


#2 Laksekjønn

Laksekjønn
  • Members
  • 440 posts

Posted 17 January 2016 - 03:49 PM

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;



#3 ielite

ielite
  • Members
  • 704 posts

Posted 18 January 2016 - 05:33 PM

Awesome, I will give it a try!



#4 ron

ron
  • Members
  • 31 posts

Posted 31 January 2016 - 11:04 PM

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

 

 

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users