Recent

Author Topic: [SOLVED] [LAMW] Unable to show a second form  (Read 953 times)

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
[SOLVED] [LAMW] Unable to show a second form
« on: January 16, 2021, 06:13:15 pm »
Hello,

In Laz4Android (LAMW), I'm trying to open a second form using the following code:
Code: Pascal  [Select][+][-]
  1. procedure TfrmFirst.btnShowSecondClick(Sender: TObject);
  2. begin
  3.  
  4.   if frmSecond = nil then
  5.     begin
  6.       gApp.CreateForm(TfrmSecond, frmSecond);
  7.       frmSecond.InitShowing(gApp);
  8.     end
  9.      else
  10.     begin
  11.       frmSecond.ReInitShowing(gApp);
  12.     end;
  13.  
  14. end;
  15.  

When I clic on the button, the first form does not disappear but stays on the background, and the components present in the second form overlap with those of the first. So, the screen becomes a mess.

Replacing "frmSecond.InitShowing(gApp);" with "frmSecond.Show;" doesn't change anything.

What am I doing wrong?

Thanks.
« Last Edit: January 16, 2021, 08:47:41 pm by pasquale »
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] Unable to show a second form
« Reply #1 on: January 16, 2021, 08:14:27 pm »
Probably, it is more correct for me to say that I am unable to hide the first form, rather than show the second one. In fact, the second form shows up but overlaps with the first, which does not hide itself.

As far as I know, Form1.Hide can't be used in Laz4Android.
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: [LAMW] Unable to show a second form
« Reply #2 on: January 16, 2021, 08:38:17 pm »

By default the forms are transparent....

So you need set some background color...
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] Unable to show a second form
« Reply #3 on: January 16, 2021, 08:47:20 pm »

By default the forms are transparent....

So you need set some background color...

THANK YOU! Once again, you've solved my problem.
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

 

TinyPortal © 2005-2018