Author Topic: UpdateLayout at Runtime and Create Objects at Runtime  (Read 1125 times)


  • Jr. Member
  • **
  • Posts: 65
    • ADiV Software
UpdateLayout at Runtime and Create Objects at Runtime
« on: October 06, 2018, 12:09:39 pm »
Hi guys, I think it is an important functionality to be able to change the design of the visual component in the execution time, this will allow us to adapt our applications to different situations. I'm working on it by modifying the LAMW functions "ResetAllRules" and "UpdateLayout", the latter does not work as it should. After the modifications that I have made, I have tested them and it works correctly. I attach an "UpdateLayout" test application and creation of components at run time, as well as the modifications that should be made in LAMW.

Example code:
Code: Pascal  [Select][+][-]
  1.        buttonTest.PosRelativeToParent := [rpTop, rpRight];
  2.        buttonTest.UpdateLayout;
  4.        // jTextView Create at Runtime, it is necessary that this is defined as
  5.        //  a local variable and you need a component for the compiler to call your .java file
  6.        if tvTest2 = nil then
  7.        begin
  8.         tvTest2 := jTextView.Create(AndroidModule1);
  9.         tvTest2.FontColor:= colBrBlack;
  10.         tvTest2.Text:= 'Anchor Test';
  11.         tvTest2.PosRelativeToParent := [rpTop, rpCenterHorizontal];
  13.         tvTest2.Init(gApp);
  14.         tvTest2.SetParentComponent(AndroidModule1);
  15.        end;

Modified "UpdateLayout" in LAMW files:
Code: Pascal  [Select][+][-]
  1. jButton
  2. jTextView
  3. jCheckBox
  4. jDBListView
  5. jEditText
  6. jHorizontalScroll, Created ResetAllRules;
  7. jImageBtn, Created ResetAllRules;
  8. jImageView, Created ResetAllRules;
  9. jListView, Created ResetAllRules;
  10. jPanel
  11. jProgressBar, Created ResetAllRules;
  12. jRadioButton
  13. jScrollView, Created ResetAllRules;
  14. jView, Created ResetAllRules;
  15. jWebView, Created ResetAllRules;


TinyPortal © 2005-2018