Recent

Author Topic: UpdateLayout at Runtime  (Read 1784 times)

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
UpdateLayout at Runtime
« on: September 28, 2018, 08:21:40 am »
Hello, as you know "UpdateLayout" at run time does not work correctly on most components. I'm working on this and I see that to work properly "UpdateLayout" by component we would have to put the following lines of code:
Code: Pascal  [Select][+][-]
  1.  lbTest.PosRelativeToAnchor := [];
  2.  lbTest.PosRelativeToParent := [rpCenterInParent];
  3.  lbTest.ResetAllRules();
  4.  lbTest.UpdateLayout();
  5.  

The problem that "ResetAllRules" is not implemented in all the visual components, so it would be necessary to implement it. And the operation of this function alone does not make any sense, ideally this function should be included in "UpdateLayout" as follows:
Code: Pascal  [Select][+][-]
  1. procedure jTextView.UpdateLayout();
  2. begin
  3.   if FInitialized then
  4.   begin
  5.    ResetAllRules();
  6.  
  7.    inherited UpdateLayout();
  8.    
  9.    UpdateLParamWidth;
  10.    UpdateLParamHeight;
  11.    jTextView_setLayoutAll(FjEnv, FjObject , Self.AnchorId);
  12.   end;
  13. end;
  14.  

So we would have a cleaner and more functional code:
Code: Pascal  [Select][+][-]
  1.  lbTest.PosRelativeToAnchor := [];
  2.  lbTest.PosRelativeToParent := [rpCenterInParent];
  3.  lbTest.UpdateLayout();
  4.  

 

TinyPortal © 2005-2018