* * *

Author Topic: PosRelativeToAnchor at run time?  (Read 238 times)

TR3E

  • New member
  • *
  • Posts: 21
PosRelativeToAnchor at run time?
« on: September 13, 2018, 06:15:41 pm »
How do I change PosRelativeToAnchor at run time?

jmpessoa

  • Hero Member
  • *****
  • Posts: 1171
Re: PosRelativeToAnchor at run time?
« Reply #1 on: September 14, 2018, 12:41:51 am »

You can look for  the demo "AppPanelRotateDemo1"

The [conceptual] draft is here:

Code: Pascal  [Select]
  1. procedure TAndroidModule1.AndroidModule1Rotate(Sender: TObject; rotate: TScreenStyle);
  2. begin
  3.   case rotate of
  4.      ssLandscape:
  5.      begin
  6.         jButton1.PosRelativeToAnchor:= [raBellow];  //initial...
  7.      end;
  8.      ssPortrait:
  9.      begin
  10.         jButton1.PosRelativeToAnchor:= [raAbove];   // <---- changed!
  11.      end;
  12.   end;
  13.  
  14.   if rotate in [ssLandscape, ssPortrait] then
  15.   begin
  16.     jButton1.ResetAllRules;
  17.     Self.UpdateLayout;
  18.   end;
  19.  
  20. end;
  21.  
« Last Edit: September 14, 2018, 12:45:00 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus