Forum > Android
Open Another Form LAMW Android
spacepascal:
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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- 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:
My code to create the form, and force to the front, I am using Android 14.:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- if (AndroidModule2 = nil) then begin gapp.CreateForm(TAndroidModule2, AndroidModule2); AndroidModule2.Init(); AndroidModule2.MoveTaskToFront(); end;
Code to show the form:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- 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:
I don't know why but don't work for me. There are some changes in LAMW in the form initialization?
dseligo:
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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
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.
Navigation
[0] Message Index
[#] Next page