Open Another Form LAMW Android lazarus / 43-Android ---------------------------------------------------------------------- spacepascal · 2024-11-04 15:15 I changed PC and i reinstalled LAWM in a new PC. Usually i used this code to Open Another form, but for somewhat reason is not working anyway. Also in the past i had some trouble to open the others forms but i resolved the issue with this code, especially with the "close;" line. 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.InitShowing();     end;    Close;Right now this code don't work anymore. Why? There is a single place where to learn lamw programming? I tested the code in Android 14 Thanks to all the heros who want to help me!! ---------------------------------------------------------------------- c4p · 2024-11-04 19:08 My code to create the form, and force to the front, I am using Android 14.: 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();          AndroidModule2.MoveTaskToFront();      end; Code to show the form: 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.Show;   I also have the second form in the uses clause of the controls.lpr The MoveTaskToFront can probably be put just before the show, not sure why I put it there, I must have had a reason ---------------------------------------------------------------------- spacepascal · 2024-11-04 22:23 I don't know why but don't work for me. There are some changes in LAMW in the form initialization? ---------------------------------------------------------------------- dseligo · 2024-11-04 22:48 What does happen? Do you have error or crash? This is code from one of my test apps, it is similar to c4p's code: 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 TAndroidModule1.AndroidModule1ActivityCreate(Sender: TObject; intentData: jObject);begin  If AndroidModule2 = nil then  begin    gApp.CreateForm(TAndroidModule2, AndroidModule2);    AndroidModule2.DoJNIPromptOnInit := False;    AndroidModule2.BackgroundColor := colbrGhostWhite;    AndroidModule2.Init;  end;end; procedure TAndroidModule1.btnForm2Click(Sender: TObject);begin  AndroidModule2.Show;end; ---------------------------------------------------------------------- spacepascal · 2024-11-05 16:42 This last example seem to work well, why the others don't work? No error nor others issues. Strange behavior maybe there was an update in LAMW Form initialization i don't know. ---------------------------------------------------------------------- dseligo · 2024-11-05 17:26 Quote from: spacepascal on November 05, 2024, 05:42:50 pmThis last example seem to work well, why the others don't work? No error nor others issues. Strange behavior maybe there was an update in LAMW Form initialization i don't know. Difference between c4p's and mine example is that I explicitly set form's background color - backgrounds in Android are transparent by default. That is the reason I asked what does happen exactly. I.e.: nothing is shown, a crash, overlapping of elements from first and second form, ... ---------------------------------------------------------------------- c4p · 2024-11-05 21:22 100% correct, I have my Background on the second form set to Black / coblBlack. Transparency by default causes so many issues. Quote from: dseligo on November 05, 2024, 06:26:45 pmQuote from: spacepascal on November 05, 2024, 05:42:50 pmThis last example seem to work well, why the others don't work? No error nor others issues. Strange behavior maybe there was an update in LAMW Form initialization i don't know. Difference between c4p's and mine example is that I explicitly set form's background color - backgrounds in Android are transparent by default. That is the reason I asked what does happen exactly. I.e.: nothing is shown, a crash, overlapping of elements from first and second form, ... ---------------------------------------------------------------------- Mongkey · 2024-12-28 23:01 Avoid using any components on another form in a long time, in android 12+ it would cause leaky error -> your app got crashing all over times.