Recent

Author Topic: [SOLVED] Moving forms  (Read 3539 times)

WickedDum

  • Full Member
  • ***
  • Posts: 211
[SOLVED] Moving forms
« on: November 28, 2016, 09:01:12 pm »
Not sure how to say this correctly... :-[

I want a different 'main' unit.

Is there a way to add/insert a Form Two into the initial unit and move Form One to a new unit? %)

Thanks!



« Last Edit: December 02, 2016, 11:26:04 pm by WickedDum »
Practice Safe Computing!!

Intel i5-4460K @ 3.2GHz | Win8.1 64-bit | FPC: v3.0 | Lazarus:  v1.6.0

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Moving forms
« Reply #1 on: November 28, 2016, 09:10:44 pm »
I don't know.

Maybe you want to create a new form, and move the order in the .lpr to display it as main form:

Code: Pascal  [Select][+][-]
  1. begin
  2.   RequireDerivedFormResource:=True;
  3.   Application.Initialize;
  4.   Application.CreateForm(TForm2, Form2); // Form2 will be the first displayed
  5.   Application.CreateForm(TForm1, Form1);
  6.   Application.Run;
  7. end.  

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Moving forms
« Reply #2 on: November 28, 2016, 11:13:40 pm »
@lainz:
I always shiver when people do that manually.

Project Options forms and then move your forms in/out and order them.

@WickedDum
In case that is really what you want, then re-order the forms as explained. But it might be that you still named your main unit "main", which would look/work a bit awkward (same as your "first" form perhaps still being named "mainForm" or "Form1".

In case you wish to change that, then first re-order then save your old unit "main" with a new name (e.g. Unit "secondunit") and rename your old "mainform' name into "secondform" using the object inspector.

Now you can name your secondly added unit "main" and "mainform".

WickedDum

  • Full Member
  • ***
  • Posts: 211
Re: Moving forms
« Reply #3 on: November 29, 2016, 07:13:18 am »
@lainz:  That's what I was looking for.  That seems pretty straight forward to me!  Actually, I am surprised to find that it is that easy.  (It is only easy if one considers the flow of their program, variable assignments, and class restrictions.)  Thanks!

@Molly:  I don't have a problem renaming them...especially since I only have one so far.;)   I was looking at the Object Inspector for renaming Units/Forms the other day, but I recognized that the renaming process did not include re-arranging the forms.

I believe I have enough info to try it now.  Thank you, both!!

If something else pops into your minds, please let me know!

Practice Safe Computing!!

Intel i5-4460K @ 3.2GHz | Win8.1 64-bit | FPC: v3.0 | Lazarus:  v1.6.0

WickedDum

  • Full Member
  • ***
  • Posts: 211
Re: Moving forms
« Reply #4 on: December 02, 2016, 11:25:40 pm »
It works like a champ!  Thank you.

Still not smooth on renaming things, but I'll get there.

Do appreciate the help!
Practice Safe Computing!!

Intel i5-4460K @ 3.2GHz | Win8.1 64-bit | FPC: v3.0 | Lazarus:  v1.6.0

 

TinyPortal © 2005-2018