Recent

Author Topic: [LAMW] Open Form2 when starting APP  (Read 404 times)

Lazarinr

  • New member
  • *
  • Posts: 9
[LAMW] Open Form2 when starting APP
« on: September 09, 2025, 01:49:03 pm »
How do I change the app's home screen? I created a project and then created a Form2. I need Form2 to open first when the app starts.

dseligo

  • Hero Member
  • *****
  • Posts: 1601
Re: [LAMW] Open Form2 when starting APP
« Reply #1 on: September 09, 2025, 03:57:17 pm »
Try this: open controls.lpi (press Ctrl + F12), then in the bottom change name and class with new form:
Code: Pascal  [Select][+][-]
  1.   gApp.AppName := gjAppName;
  2.   gApp.ClassName := gjClassName;
  3.   gApp.Initialize;
  4.   gApp.CreateForm(TAndroidModule1, AndroidModule1); // <----- THIS LINE to TAndroidModule2 and AndroidModule2 i.e.
  5. end.


I didn't try it, but it should work.

Lazarinr

  • New member
  • *
  • Posts: 9
Re: [LAMW] Open Form2 when starting APP
« Reply #2 on: September 09, 2025, 07:55:22 pm »
I tried, but it didn't work. Since I only have two units in the project, I deleted the project and created it again, adding the unit. Thanks for your help.


n7800

  • Hero Member
  • *****
  • Posts: 554
  • Lazarus IDE contributor
    • GitLab profile
Re: [LAMW] Open Form2 when starting APP
« Reply #3 on: September 19, 2025, 12:54:48 am »
Menu > Project > Project Options, then the "Forms" category on the left.

Here you can move forms around using the buttons (with up/down arrows icons). When the program starts, the first form in the list opens.
In fact, you can manually swap the lines with "CreateForm"

Just don't move a form to another list (left/right), otherwise it won't be automatically created on startup (by default, all forms are always created, but all but the first are hidden).
Although I'm not sure how this works on Android.
« Last Edit: September 19, 2025, 12:57:35 am by n7800 »

 

TinyPortal © 2005-2018