Lamw(solved) - Strange behavior lazarus / 43-Android ---------------------------------------------------------------------- marcos-ebm · 2024-01-15 07:29 [using the translator] when creating the second form using the command Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i        if AndroidModule2 = nil then    begin        gApp.CreateForm(TAndroidModule2, AndroidModule2);        AndroidModule2.Init;    end;    AndroidModule2.Show;  the second form is appearing with the components of the first form, that is, the second form appears with the button from the first form Has anyone ever experienced this? ---------------------------------------------------------------------- vangli · 2024-01-15 07:43 How is TAndroidModule2 defined? ---------------------------------------------------------------------- marcos-ebm · 2024-01-15 07:48 Quote from: vangli on January 15, 2024, 08:43:41 amHow is TAndroidModule2 defined? within a button click, but I've already tried adding activityCreate, JNIPrompt, but the behavior is always the same ---------------------------------------------------------------------- vangli · 2024-01-15 07:54 Pls show code of class definition? Edited: And think about inheritanse. ---------------------------------------------------------------------- c4p · 2024-01-15 08:16 I would define the creation of the second form in event OnJNIPrompt of AndroidModule1 then call your second form show from a button click event in AndroidModule1. This creates the second form on start, allowing you to then to show the second form from your button without issue. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure AndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);begin    if AndroidModule2 = nil then    begin        gApp.CreateForm(TAndroidModule2, AndroidModule2);        AndroidModule2.Init;    end;end; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure AndroidModule1.Button1Click(Sender: TObject);begin      AndroidModule2.Show;end; ---------------------------------------------------------------------- marcos-ebm · 2024-01-15 08:20 Quote from: vangli on January 15, 2024, 08:54:00 amPls show code of class definition? Edited: And think about inheritanse. ok, When I get home I'll post it Quote from: c4p on January 15, 2024, 09:16:46 amI would define the creation of the second form in event OnJNIPrompt of AndroidModule1 then call your second form show from a button click event in AndroidModule1. This creates the second form on start, allowing you to then to show the second form from your button without issue. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure AndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);begin    if AndroidModule2 = nil then    begin        gApp.CreateForm(TAndroidModule2, AndroidModule2);        AndroidModule2.Init;    end;end; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure AndroidModule1.Button1Click(Sender: TObject);begin      AndroidModule2.Show;end; I've done it the same way as you, but the behavior remains the same ---------------------------------------------------------------------- dseligo · 2024-01-15 08:25 Quote from: marcos-ebm on January 15, 2024, 08:29:11 amthe second form is appearing with the components of the first form, that is, the second form appears with the button from the first form Choose some background color for second form (change Background property of form). If you leave it at default, Android considers background as transparent and shows previous form underneath. ---------------------------------------------------------------------- c4p · 2024-01-15 08:56 Also try calling below before showing the form in case it's a Z-order visibility issue. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i AndroidModule2.MoveTaskToFront; The post below regarding background/transparency of the AndroidModule2 form is a good call and worth checking too. Quote from: dseligo on January 15, 2024, 09:25:38 amQuote from: marcos-ebm on January 15, 2024, 08:29:11 amthe second form is appearing with the components of the first form, that is, the second form appears with the button from the first form Choose some background color for second form (change Background property of form). If you leave it at default, Android considers background as transparent and shows previous form underneath. ---------------------------------------------------------------------- marcos-ebm · 2024-01-15 09:44 Guys, I would like to thank everyone for their help vangli c4p dseligo The problem was solved thanks to dseligo's tip, thank you very much ---------------------------------------------------------------------- c4p · 2024-01-15 13:25 Good shout @dseligo