Recent

Author Topic: Bug in PosRelativeToAnchor  (Read 1914 times)

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Bug in PosRelativeToAnchor
« on: September 26, 2018, 05:40:52 pm »
Hi, I am trying to execute this code, which modifies the properties of "PosRelativeToAnchor" at runtime and does not work:
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.btTestClick(Sender: TObject);
  2. begin
  3.  lbTest2.Anchor := btTest;
  4.  lbTest2.PosRelativeToParent:=[rpCenterHorizontal];
  5.  lbTest2.PosRelativeToAnchor:=[raBelow];
  6.  lbTest2.ResetAllRules();
  7.  lbTest2.UpdateLayout();
  8. end;

I think I know why, if we modify these lines, it would work correctly, I've tried it and it works (in "androidwidget.pas"):
Code: Pascal  [Select][+][-]
  1. procedure jVisualControl.UpdateLayout();
  2. begin
  3.     if Self.Anchor <> nil then
  4.      Self.AnchorId:= Self.Anchor.Id
  5.     else
  6.      Self.AnchorId:= -1;
  7. end;

Attached example of the test performed, I assume that in other components will have the same problem.
« Last Edit: September 26, 2018, 05:55:58 pm by TR3E »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2330
Re: Bug in PosRelativeToAnchor
« Reply #1 on: September 26, 2018, 06:25:06 pm »

I will commit your fix!

Thank you!!!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018