MainForm... but... has it ever happened to you that the MainForm that you want is not an option on the Main Form drop dow list?N/Adelphi, delphi3000, article, borland, vcl, code-snippet, , lost, main, mainform, form, project-options, project, project-properties, propertiesN/A">
 
Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
492 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


lost your MainForm?Format this article printer-friendly!Bookmark function is only available for registered users!
perhaps a bug in Delphi IDE ¿o.o?
Product:
Delphi all versions
Category:
N/A
Skill Level:
Scoring:
Last Update:
03/06/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet lost main mainform form project-options project project-properties properties
Times Scored:
3
Visits:
2321
Uploader: Eber Irigoyen
Company: BTXSys
Reference: N/A
 
Question/Problem/Abstract:
When you go to "Projects", "Options", on the Delphi menu (having a project opened), it opens a kinda project properties dialog and the default tab is "general", that's where you set your MainForm... but... has it ever happened to you that the MainForm that you want is not an option on the Main Form drop dow list?
Answer:



a few days ago that happened to me... I could not set the Form that I wanted as my MainForm, the solution is so stupid... =oP... it is... I'll show you

usually if you open your project source ("Project", "View Source"), it looks some like this:

Program myproject;

uses
  Forms,
  myMainFormu in 'mymainformu.pas' {MainForm},
  mysecondaryformu in 'mysecondaryformu.pas' {SecondaryForm},
  AnotherFormu in 'anotherformu.pas' {AnotherForm};

begin
  Application.Initialize;
  Application.CreateForm(TmyMainForm, myMainForm);
  Application.CreateForm(Tmysecondaryform, mysecondaryform);
  Application.CreateForm(TAnotherForm, AnotherForm);
  Application.Run;
end.

...that's a regular project and everything would work fine... go to "Project", "Options" and you can set any of the 3 forms to be MainForm... now if you change this (on the third line of the project)

  myMainFormn in 'mymainform.pas', {MainForm}

now, go to "Project", "Options"... is gone!... do you see what I changed?
I just changed the ","... instead of
'mymainform.pas' {MainForm},
I changed to
'mymainform.pas', {MainForm}

the same happens if you remove the {MainForm} as:
'mymainform.pas',

so the solution, whatever you did, either changed the comma or removed the comment, just make sure that you have this format:

myMainFormu in 'mymainformu.pas' {MainForm},

and you'll be able to put that as MainForm

maybe this is documented somewhere... this happened to me and I couldn't figure it out, 'til I just saw that that was the only difference with the other forms on the project source, changed it to look as the others... and fixed it =o)
and so I thought I would share my experience with you...

this happened using:
Delphi5 UpdatePack 1

keep up coding
salu2

EberSys





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Another thought
    Magnus Flysjö (Mar 6 2002 11:02PM)

When I add a form to an existing project I always remove the autocreation in the dpr file (or in the project->options menu) I then create each form only when I need them, and when I'm done, I destroy it.

Like this:

Lets say I have a main form and a form that is used to make some settings to the application, SettingsForm...
I remove the SettingsForm from the "Project->Options" autocreation and then call the following procedure when I want to use the form:

procedure TMainForm.AChangeSettings(Sender : TObject);
var SettingsForm : TSettingsForm;
begin
SettingsForm := TSettingsForm.Create(self);
try
  if SettingsForm.Execute then begin
   // Do stuff to update your mainform...
   // This part is only called if the user pressed the OK button in the TSettingsForm

  end;
finally
  SettingsForm.free;
end;
end;

It's a great idea to make a "Execute" function in all your forms (Except for the MainForm) that looks like the following:

function TSettingsForm.Execute : boolean;
begin
// Init the SettingsForm's controls here if you want...
result := (ShowModal = mrOK);
end;

Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
A. B. Talal
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)